Submission #24035
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #include<bits/stdc++.h> int N,K; int a[26]; bool dfs( int sum, int ix){ if (sum==K) return 1; if (ix==N) return 0; return dfs(sum+a[ix],ix+1) | dfs(sum,ix+1); } main(){ int i; scanf ( "%d %d" ,&N,&K); for (i=0;i<N;++i) scanf ( "%d" ,a+i); printf ( "%s\n" ,dfs(0,0)? "OK" : "NG" ); } |
ステータス
項目 | データ |
---|---|
問題 | 0064 - 足し算できる? |
ユーザー名 | Arumakan_ei1727 |
投稿日時 | 2017-08-01 09:13:39 |
言語 | C++11 |
状態 | Accepted |
得点 | 5 |
ソースコード長 | 291 Byte |
最大実行時間 | 88 ms |
最大メモリ使用量 | 616 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 5 / 5 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
AddInput1.txt | AC | 14 ms | 480 KB |
1
|
AddInput2.txt | AC | 13 ms | 580 KB |
1
|
AddInput3.txt | AC | 14 ms | 548 KB |
1
|
AddInput4.txt | AC | 15 ms | 388 KB |
1
|
AddInput5.txt | AC | 88 ms | 616 KB |
1
|
AddInput6.txt | AC | 13 ms | 460 KB |
1
|