[백준 1110번 - java] 더하기 사이클

[백준 1110번 - java] 더하기 사이클

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); } }

from http://dotddori-prgmwh.tistory.com/66 by ccl(A) rewrite - 2021-11-04 22:27:35