結果

問題 No.1168 Digit Sum Sequence
ユーザー kaseken
提出日時 2020-08-16 00:39:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 4,913 ms
コンパイル使用メモリ 190,664 KB
最終ジャッジ日時 2025-01-13 01:47:57
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int64_t f(int64_t n)
{
  int64_t ret = 0;
  while (n > 0)
  {
    ret += n % 10;
    n /= 10;
  }
  return ret;
}

int main()
{
  int64_t N;
  cin >> N;
  for (int i = 0; i < 100; i++)
  {
    N = f(N);
  }
  cout << N << endl;
}
0