結果

問題 No.1168 Digit Sum Sequence
ユーザー 🍮かんプリン
提出日時 2020-08-14 21:22:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 1,358 ms
コンパイル使用メモリ 157,532 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-10 12:26:05
合計ジャッジ時間 2,201 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.08.14 21:22:02
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int keta_sum(int x) {
    int res = 0;
    while(x) {
        res += x % 10;
        x /= 10;
    }
    return res;
}
int main() {
    int n;cin >> n;
    for (int i = 1; i < 100; i++) {
        n = keta_sum(n);
    }
    cout << n << endl;
    return 0;
}
0