목록Algorithm/Java (125)
gimmickbutreal
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); int cnt = 0; int copy = N; while (true) { N = ((N % 10) * 10) + (((N / 10) + (N % 10)) % 10); cnt++; if (copy == N) { break; } } System.out.println(cnt); } } Colored by Color Scripter..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 // 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. // 입력은 여러 개의 테스트 케이스로 이루어져 있다. // 각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner sc=new Scanner(System.in); while(true){ int A=sc.nextInt(); int B=sc.nextInt(); if(A==0 && B==0){ sc.close(); break; } System.out.println(A+B); } } } Colored by Color Scripter cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 // 정수 N개로 이루어진 수열 A와 정수 X가 주어진다. 이때, A에서 X보다 작은 수를 모두 출력하는 프로그램을 작성하시오. // 첫째 줄에 N과 X가 주어진다. (1 ≤ N, X ≤ 10,000) // 둘째 줄에 수열 A를 이루는 정수 N개가 주어진다. 주어지는 정수는 모두 1보다 크거나 같고, 10,000보다 작거나 같은 정수이다. // X보다 작은 수를 입력받은 순서대로 공백으로 구분해 출력한다. X보다 작은 수는 적어도 하나 존재한다. import java.util.Scanner; public class Main{ public static void main(String args[])..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import java.util.Scanner; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); for(int i1=1;i1=1;i2--) { System.out.printf(" "); } for(int i3=1;i3
https://www.acmicpc.net/problem/2438 2438번: 별 찍기 - 1 첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제 www.acmicpc.net 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); for(int i1 = 1; i1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import java.util.Scanner; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a,b,c; for(int i=1; i
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // 각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다. import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); int a = in.nextInt(); for (int i = 1; i