https://www.acmicpc.net/problem/1110


내 답안
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
int first = s.nextInt();
int N = first;
int cnt = 0;
while(true) {
N = (10 * (N%10)) + ((N/10) + (N%10))%10;
cnt++;
if (first == N) break;
}
System.out.println(cnt);
}
}
'Coding Test > 백준' 카테고리의 다른 글
[백준 2562번 - java] 최댓값 (0) | 2021.11.08 |
---|---|
[백준 10818번 - java] 최소, 최대 (0) | 2021.11.08 |
[백준 10952번 - java] A+B - 5 (0) | 2021.11.04 |
[백준 10871번 - java] X보다 작은 수 (0) | 2021.11.04 |
[백준 2439번 - java] 별찍기 - 2 (0) | 2021.11.04 |