結果
| 問題 |
No.1168 Digit Sum Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-28 16:05:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 302 bytes |
| コンパイル時間 | 1,885 ms |
| コンパイル使用メモリ | 191,272 KB |
| 最終ジャッジ日時 | 2025-01-15 16:09:31 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int a = n;
for (int i = 0; i < 100; i++) {
int ds = 0;
while (a > 0) {
ds += a % 10;
a /= 10;
}
a = ds;
}
cout << a << '\n';
return 0;
}