結果

問題 No.1168 Digit Sum Sequence
ユーザー Geckoちゃん
提出日時 2020-08-16 20:08:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 67,136 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-11 10:41:05
合計ジャッジ時間 1,507 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;


int main() {
    // cout << "aaa" << endl;
    int x;
    cin >> x;
    string x2 = to_string(x);
    for(int i=1; i <= 100; i++) {

        int tmp = 0;
        for(char& c: x2) {
            tmp += int(c) - '0';
        }
        x2 = to_string(tmp);
    }
    cout << x2 << endl;
}
0