結果

問題 No.1168 Digit Sum Sequence
ユーザー boutarou
提出日時 2020-08-14 21:21:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 1,534 ms
コンパイル使用メモリ 166,160 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 12:22:51
合計ジャッジ時間 2,298 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
*    author:  boutarou
*    created: 14.08.2020 21:18:27
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
using ll = long long;
using P = pair<int, int>;

long long digit(long long x) {
    long long cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}

int main() {
    ll n;
    cin >> n;
    rep(i,99) {
        n = digit(n);
    }
    cout << n << endl;

    return 0;
}
0