Submission #64700


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define int long long
using namespace std;
signed main(){
int n;
cin>>n;
vector<int> dp(1000006,1);
for(int i=1;i<=n;++i){
int b=0;
int p=i;
while(p){
b+=p%10;
p/=10;
}
dp[i+b]+=dp[i];
}
cout<<dp[n]<<"\n";
return 0;
}

ステータス

項目 データ
問題 1267 - 桁和 (Digit Sum)
ユーザー名 r2031
投稿日時 2020-11-11 18:04:04
言語 C++17
状態 Accepted
得点 100
ソースコード長 387 Byte
最大実行時間 37 ms
最大メモリ使用量 8500 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 33 ms 8412 KB
1
01-02.txt AC 26 ms 8500 KB
1
01-03.txt AC 33 ms 8332 KB
1
01-04.txt AC 23 ms 8424 KB
1
01-05.txt AC 29 ms 8388 KB
1
01-06.txt AC 23 ms 8352 KB
1
01-07.txt AC 33 ms 8444 KB
1
01-08.txt AC 26 ms 8404 KB
1
01-09.txt AC 33 ms 8364 KB
1
01-10.txt AC 16 ms 8328 KB
1
01-11.txt AC 16 ms 8292 KB
1
01-12.txt AC 27 ms 8384 KB
1
01-13.txt AC 24 ms 8348 KB
1
01-14.txt AC 31 ms 8440 KB
1
01-15.txt AC 37 ms 8408 KB
1
01-16.txt AC 28 ms 8372 KB
1
01-17.txt AC 27 ms 8464 KB
1
sample-01.txt AC 21 ms 8428 KB
1
sample-02.txt AC 16 ms 8388 KB
1
sample-03.txt AC 24 ms 8352 KB
1