結果

問題 No.1168 Digit Sum Sequence
ユーザー kyoprounokyoprouno
提出日時 2020-08-14 21:23:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 926 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 172,516 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-18 19:21:44
合計ジャッジ時間 17,270 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,756 KB
testcase_01 AC 472 ms
6,816 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1,310 ms
6,944 KB
testcase_13 TLE -
testcase_14 AC 1,634 ms
6,940 KB
testcase_15 TLE -
testcase_16 AC 454 ms
6,940 KB
testcase_17 TLE -
testcase_18 AC 239 ms
6,944 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

const ll INF=1e9+7;

const ll mod=1e9+7;

int main() {
    ll n;
    cin >> n;
    ll val=n;
    rep(i,n){
        if(i==0) continue;
        ll sum=0;
        ll v=val;
        while(v){
            sum+=v%10;
            v/=10;
        }
        val=sum;
    }
    cout << val << endl;
    return 0;
}
0