結果

問題 No.1168 Digit Sum Sequence
ユーザー 尻リハビリ
提出日時 2020-09-08 04:13:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 73,888 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-29 11:44:15
合計ジャッジ時間 1,706 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <utility>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>


using namespace std;

int main(){

    string n;
    long long int ans;

    cin>>n;

    for (int i=0;i<100;i++){
            ans=0;
        for (int j=0;j<n.size();j++){
            ans+=n[j]-'0';

           
        }
         n=to_string(ans);
            
    }
    cout<<ans<<endl;
    
    

   
    
}
0