結果

問題 No.1168 Digit Sum Sequence
ユーザー bluemeganebluemegane
提出日時 2021-04-18 09:27:07
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 348 bytes
コンパイル時間 774 ms
コンパイル使用メモリ 61,140 KB
実行使用メモリ 22,764 KB
最終ジャッジ日時 2023-09-17 07:31:42
合計ジャッジ時間 3,813 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,768 KB
testcase_01 AC 57 ms
20,768 KB
testcase_02 AC 57 ms
18,668 KB
testcase_03 AC 55 ms
20,728 KB
testcase_04 AC 56 ms
20,684 KB
testcase_05 AC 56 ms
20,764 KB
testcase_06 AC 57 ms
18,568 KB
testcase_07 AC 57 ms
22,660 KB
testcase_08 AC 56 ms
20,764 KB
testcase_09 AC 56 ms
20,708 KB
testcase_10 AC 59 ms
20,836 KB
testcase_11 WA -
testcase_12 AC 58 ms
20,680 KB
testcase_13 WA -
testcase_14 AC 56 ms
22,764 KB
testcase_15 AC 57 ms
20,716 KB
testcase_16 AC 56 ms
20,720 KB
testcase_17 AC 57 ms
20,724 KB
testcase_18 AC 55 ms
20,676 KB
testcase_19 AC 57 ms
20,768 KB
testcase_20 AC 57 ms
20,636 KB
testcase_21 AC 56 ms
22,736 KB
testcase_22 AC 56 ms
22,760 KB
testcase_23 AC 56 ms
20,720 KB
testcase_24 AC 56 ms
20,688 KB
testcase_25 AC 56 ms
20,652 KB
testcase_26 AC 56 ms
20,616 KB
testcase_27 AC 56 ms
20,716 KB
testcase_28 AC 57 ms
20,760 KB
testcase_29 AC 55 ms
20,668 KB
testcase_30 AC 56 ms
22,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        while (n > 10) n = calc(n);
        Console.WriteLine(n);
    }
    static int calc(int a)
    {
        var res = 0;
        var b = a.ToString();
        foreach (var x in b) res += x - '0';
        return res;
    }
}
0