結果
問題 | No.1168 Digit Sum Sequence |
ユーザー | mmn15277198 |
提出日時 | 2020-08-14 21:24:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 543 bytes |
コンパイル時間 | 947 ms |
コンパイル使用メモリ | 92,784 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 13:52:25 |
合計ジャッジ時間 | 1,787 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 |
ソースコード
#include<iostream> #include<stdio.h> #include<algorithm> #include<vector> #include<string.h> #include<math.h> #include<map> #include<iomanip> #include<queue> const long long INF = 1e6+7; const long long MOD = 1e9+7; const double PI=acos(-1); using namespace std; long long keta_sum(long long x){ long long sum=0; while(x){ sum+=x%10; x/=10; } return sum; } int main(){ long long n; cin >> n; vector<long long> ans(100); ans[0]=n; for(int i=1;i<100;i++){ ans[i]=keta_sum(ans[i-1]); } cout << ans[99] << endl; return 0; }