結果

問題 No.1168 Digit Sum Sequence
ユーザー NewGarden
提出日時 2020-08-14 21:22:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 114,600 KB
最終ジャッジ日時 2025-01-12 23:07:08
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=100010;
const ll mod=1e9+7;


int main(){
  ll n;
  cin >> n;
  rep(i,99){
    ll tmp = 0;
    while(n>0){
      tmp += n%10;
      n /= 10;
    }
    n = tmp;
  }

  cout << n << ln;
  return 0;
}
0