結果

問題 No.1168 Digit Sum Sequence
ユーザー Sooh31Sooh31
提出日時 2020-08-14 21:24:38
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 2,112 ms
コンパイル使用メモリ 191,164 KB
最終ジャッジ日時 2025-01-12 23:10:35
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const int INF = 1001001001;

int main(){
    int n; cin >> n;
    for(int i = 0; i < 100; i++){
        int tmp = 0;
        while(n){
            tmp += n % 10;
            n /= 10;
        }
        n = tmp;
        //cout << tmp << endl;
    }
    cout << n << endl;
}
0