Submission #00030


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define itn int
#define fi first
#define se second
signed main(void) {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a[200];
int t[105][30]={};
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
t[0][a[0]]=1;
for(int i=1;i<n-1;i++){
for(int j=0;j<=20;j++){
if(t[i-1][j]!=0){
if(j+a[i]<=20) t[i][j+a[i]]+=t[i-1][j];
if(j-a[i]>=0 ) t[i][j-a[i]]+=t[i-1][j];
}
}
}
cout<<t[n-2][a[n-1]]<<"\n";
return 0;
}

ステータス

項目 データ
問題 0009 - 1年生 (A First Grader)
ユーザー名 ei1941
投稿日時 2020-09-15 16:33:56
言語 C++17
状態 Accepted
得点 1
ソースコード長 547 Byte
最大実行時間 43 ms
最大メモリ使用量 532 KB

セット

セット 得点 Cases
1 入力1 0.2 / 0.2 *1.txt
2 入力2 0.2 / 0.2 *2.txt
3 入力3 0.2 / 0.2 *3.txt
4 入力4 0.2 / 0.2 *4.txt
5 入力5 0.2 / 0.2 *5.txt

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
2011-yo-t4-in1.txt AC 43 ms 476 KB
1
2011-yo-t4-in2.txt AC 18 ms 408 KB
2
2011-yo-t4-in3.txt AC 19 ms 468 KB
3
2011-yo-t4-in4.txt AC 15 ms 532 KB
4
2011-yo-t4-in5.txt AC 23 ms 468 KB
5