結果

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    string n;
    cin >> n;
    int m = 0;
    for(int i = 0; i < 3; i++){
        m=0;
        for(int j = 0; j < n.length(); j++){
            m += n[j]-'0';
        }
        n = to_string(m);
    }
    cout << m << endl;
    return 0;
}
0