結果

問題 No.1168 Digit Sum Sequence
ユーザー curryudon08
提出日時 2021-02-23 19:05:13
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 952 ms
コンパイル使用メモリ 114,216 KB
実行使用メモリ 27,064 KB
最終ジャッジ日時 2024-09-22 13:58:38
合計ジャッジ時間 2,845 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace _1168
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            while(true){
                var n = s.Select(c => int.Parse(c.ToString())).Sum();

                if(n  < 10){
                    Console.WriteLine(n);
                    break;
                }
                s = n.ToString();
            }
        }
    }
}
0