結果

問題 No.1168 Digit Sum Sequence
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-04 09:24:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 3,024 ms
コンパイル使用メモリ 74,748 KB
実行使用メモリ 54,484 KB
最終ジャッジ日時 2024-04-15 03:09:38
合計ジャッジ時間 7,765 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
54,248 KB
testcase_01 AC 128 ms
54,172 KB
testcase_02 AC 126 ms
53,884 KB
testcase_03 AC 125 ms
54,276 KB
testcase_04 AC 124 ms
53,876 KB
testcase_05 AC 122 ms
53,868 KB
testcase_06 AC 125 ms
54,324 KB
testcase_07 AC 122 ms
54,484 KB
testcase_08 AC 121 ms
53,976 KB
testcase_09 AC 111 ms
52,736 KB
testcase_10 AC 122 ms
54,144 KB
testcase_11 AC 110 ms
53,128 KB
testcase_12 AC 122 ms
54,288 KB
testcase_13 AC 127 ms
54,136 KB
testcase_14 AC 122 ms
54,184 KB
testcase_15 AC 125 ms
54,232 KB
testcase_16 AC 112 ms
52,980 KB
testcase_17 AC 132 ms
54,364 KB
testcase_18 AC 132 ms
54,004 KB
testcase_19 AC 124 ms
54,388 KB
testcase_20 AC 128 ms
54,216 KB
testcase_21 AC 127 ms
53,888 KB
testcase_22 AC 123 ms
54,144 KB
testcase_23 AC 126 ms
53,996 KB
testcase_24 AC 124 ms
54,048 KB
testcase_25 AC 117 ms
54,112 KB
testcase_26 AC 120 ms
54,004 KB
testcase_27 AC 120 ms
53,920 KB
testcase_28 AC 120 ms
53,844 KB
testcase_29 AC 103 ms
52,876 KB
testcase_30 AC 119 ms
54,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

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

	    	Scanner sc = new Scanner(System.in);
	    	int a0 = sc.nextInt();
	    	for (int i = 0; i < 100; i++) {
	    		a0 = nextA(a0);
	    	}

	    	System.out.println(nextA(a0));

	    	}

	    static int nextA(int a) {
	    	int next_a = 0;
	    	while (a > 0) {
	    		next_a += a % 10;
	    		a /= 10;
	    	}

	    	return next_a;
	    }

}
0