結果

問題 No.1168 Digit Sum Sequence
ユーザー eagleeagle
提出日時 2022-06-15 14:28:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 2,079 ms
コンパイル使用メモリ 73,840 KB
実行使用メモリ 54,420 KB
最終ジャッジ日時 2024-04-14 22:58:14
合計ジャッジ時間 7,520 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
53,756 KB
testcase_01 AC 132 ms
54,256 KB
testcase_02 AC 133 ms
54,124 KB
testcase_03 AC 133 ms
54,016 KB
testcase_04 AC 131 ms
54,140 KB
testcase_05 AC 134 ms
54,384 KB
testcase_06 AC 129 ms
54,180 KB
testcase_07 AC 132 ms
53,980 KB
testcase_08 AC 130 ms
53,968 KB
testcase_09 AC 132 ms
54,124 KB
testcase_10 AC 130 ms
54,172 KB
testcase_11 AC 130 ms
54,220 KB
testcase_12 AC 131 ms
54,236 KB
testcase_13 AC 131 ms
54,280 KB
testcase_14 AC 131 ms
54,220 KB
testcase_15 AC 131 ms
53,832 KB
testcase_16 AC 131 ms
54,420 KB
testcase_17 AC 132 ms
54,076 KB
testcase_18 AC 132 ms
53,888 KB
testcase_19 AC 132 ms
54,220 KB
testcase_20 AC 131 ms
54,124 KB
testcase_21 AC 132 ms
54,056 KB
testcase_22 AC 132 ms
53,876 KB
testcase_23 AC 133 ms
54,068 KB
testcase_24 AC 134 ms
54,188 KB
testcase_25 AC 132 ms
54,124 KB
testcase_26 AC 132 ms
54,024 KB
testcase_27 AC 132 ms
54,268 KB
testcase_28 AC 131 ms
54,000 KB
testcase_29 AC 133 ms
54,032 KB
testcase_30 AC 132 ms
53,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long a = N;
		for(int i = 2; i <= 100; i++) {
			int sum;
			long val = a;
			a = 0;
			while(val > 0) {
				a += val % 10;
				val /= 10;
			}
		}
		System.out.println(a);
	}
}
0