結果
| 問題 |
No.1168 Digit Sum Sequence
|
| コンテスト | |
| ユーザー |
merom686
|
| 提出日時 | 2020-08-14 21:22:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 401 bytes |
| コンパイル時間 | 905 ms |
| コンパイル使用メモリ | 89,788 KB |
| 最終ジャッジ日時 | 2025-01-12 23:05:31 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;
int f(int n) {
int s = 0;
while (n > 0) s += n % 10, n /= 10;
return s;
}
int main() {
int n;
cin >> n;
for (int i = 1; i < 100; i++) {
n = f(n);
}
cout << n << endl;
return 0;
}
merom686