結果

問題 No.1168 Digit Sum Sequence
ユーザー 遭難者遭難者
提出日時 2020-10-13 11:40:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 2,127 ms
コンパイル使用メモリ 72,004 KB
実行使用メモリ 40,104 KB
最終ジャッジ日時 2023-09-28 00:00:58
合計ジャッジ時間 6,267 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
39,692 KB
testcase_01 AC 112 ms
39,368 KB
testcase_02 AC 107 ms
39,464 KB
testcase_03 AC 111 ms
39,680 KB
testcase_04 AC 105 ms
39,108 KB
testcase_05 AC 106 ms
39,924 KB
testcase_06 AC 106 ms
39,504 KB
testcase_07 AC 105 ms
39,452 KB
testcase_08 AC 107 ms
39,504 KB
testcase_09 AC 110 ms
39,708 KB
testcase_10 AC 104 ms
39,140 KB
testcase_11 AC 108 ms
39,616 KB
testcase_12 AC 111 ms
39,704 KB
testcase_13 AC 108 ms
39,144 KB
testcase_14 AC 108 ms
39,320 KB
testcase_15 AC 108 ms
39,348 KB
testcase_16 AC 113 ms
39,064 KB
testcase_17 AC 110 ms
39,500 KB
testcase_18 AC 106 ms
39,180 KB
testcase_19 AC 107 ms
39,716 KB
testcase_20 AC 105 ms
39,432 KB
testcase_21 AC 103 ms
39,100 KB
testcase_22 AC 106 ms
39,224 KB
testcase_23 AC 108 ms
39,128 KB
testcase_24 AC 106 ms
39,512 KB
testcase_25 AC 110 ms
39,400 KB
testcase_26 AC 114 ms
40,104 KB
testcase_27 AC 108 ms
39,716 KB
testcase_28 AC 110 ms
39,840 KB
testcase_29 AC 114 ms
39,600 KB
testcase_30 AC 111 ms
39,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		int n = Integer.parseInt(sc.next());
		for(int i = 0 ; i < 100 ; i++){
			int s = 0 , cl = n;
			while(cl != 0){
				s += cl % 10;
				cl /= 10;
			}
			n = s;
		}
		ou.println(n);
		ou.flush();
		sc.close();
	}
}
0