더하기 사이클 (1110)

유지원·2021년 8월 6일
0

백준OJ

목록 보기
30/32
post-thumbnail

Java 11

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());

        int cnt = 0;
        int copy = n;

        do {
            n = ((n % 10) * 10) + (((n / 10) + (n % 10)) % 10);
            cnt ++;
        } while (copy != n);

        System.out.println(cnt);
    }
}
profile
👋 https://github.com/ujw0712

0개의 댓글