結果
問題 | No.1168 Digit Sum Sequence |
ユーザー |
![]() |
提出日時 | 2020-08-14 23:33:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 348 bytes |
コンパイル時間 | 2,254 ms |
コンパイル使用メモリ | 190,788 KB |
最終ジャッジ日時 | 2025-01-13 00:47:47 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int64_t N; cin >> N; auto f = [](int64_t x) { int64_t res = 0; while (x > 0) { res += x % 10; x /= 10; } return res; }; for (int i = 0; i < 99; i++) { N = f(N); } cout << N << '\n'; return 0; }