알고리즘

백준 1110번 자바 성공코드

도랜니 2019. 6. 20. 15:04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.Scanner;
 
public class Main {
    
    public static void main(String[] args)  {
        
        Scanner scanner = new Scanner(System.in);
 
        int num=scanner.nextInt();
        
        int check = num;
        
        int count =0;
        
 
        while(true) {
            
            check =(check%10)*10+((check/10 +check%10)%10);    
            count++;
            
            if(num==check)
                break;
        }
            
        System.out.println(count);
    
    
}}
 
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none; color:white">cs