結果

問題 No.1168 Digit Sum Sequence
ユーザー sorag
提出日時 2022-07-24 12:28:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 66,500 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 06:33:19
合計ジャッジ時間 1,747 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n;
    cin>>n;
        while(n>=10){
            int sum=0;
            while (n>0){
                sum=sum+n%10;
                n/=10;
        }
            n=sum;
        }
    cout<<n<<endl;
        return 0;
}
0