結果

問題 No.1168 Digit Sum Sequence
ユーザー K_Meraq6
提出日時 2020-11-02 17:04:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 65,408 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-22 06:22:51
合計ジャッジ時間 1,391 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    for (int i = 0; i < 99; ++i) {
        int c = 0;
        c += n / 1000000000; n = n % 1000000000;
        c += n / 100000000; n = n % 100000000;
        c += n / 10000000; n = n % 10000000;
        c += n / 1000000; n = n % 1000000;
        c += n / 100000; n = n % 100000;
        c += n / 10000; n = n % 10000;
        c += n / 1000; n = n % 1000;
        c += n / 100; n = n % 100;
        c += n / 10; n = n % 10;
        c += n;

        n = c;
    }
    cout << n << endl;
}
0