結果

問題 No.1168 Digit Sum Sequence
ユーザー EvbCFfp1XBEvbCFfp1XB
提出日時 2020-08-14 21:26:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 2,643 ms
コンパイル使用メモリ 74,708 KB
実行使用メモリ 41,524 KB
最終ジャッジ日時 2024-04-18 20:34:50
合計ジャッジ時間 7,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
41,272 KB
testcase_01 AC 126 ms
41,440 KB
testcase_02 AC 107 ms
40,056 KB
testcase_03 AC 113 ms
41,284 KB
testcase_04 AC 109 ms
39,712 KB
testcase_05 AC 110 ms
40,124 KB
testcase_06 AC 119 ms
41,412 KB
testcase_07 AC 126 ms
41,488 KB
testcase_08 AC 124 ms
40,936 KB
testcase_09 AC 117 ms
40,684 KB
testcase_10 AC 121 ms
41,180 KB
testcase_11 AC 110 ms
41,132 KB
testcase_12 AC 114 ms
41,076 KB
testcase_13 AC 118 ms
41,044 KB
testcase_14 AC 123 ms
41,524 KB
testcase_15 AC 117 ms
41,400 KB
testcase_16 AC 104 ms
40,000 KB
testcase_17 AC 116 ms
41,324 KB
testcase_18 AC 117 ms
41,236 KB
testcase_19 AC 108 ms
40,920 KB
testcase_20 AC 109 ms
41,152 KB
testcase_21 AC 106 ms
40,172 KB
testcase_22 AC 127 ms
41,276 KB
testcase_23 AC 128 ms
41,432 KB
testcase_24 AC 114 ms
41,524 KB
testcase_25 AC 112 ms
41,148 KB
testcase_26 AC 121 ms
41,256 KB
testcase_27 AC 112 ms
41,120 KB
testcase_28 AC 121 ms
41,384 KB
testcase_29 AC 110 ms
41,364 KB
testcase_30 AC 116 ms
41,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int a = N;
            for (int i = 2; i < 100; i++) {
                int sum = 0;
                while (a != 0) {
                    sum += a % 10;
                    a /= 10;
                }
                a = sum;
            }
            System.out.println(a);
        }
    }
}
0