Language: C

#include <stdio.h>
 
int sol(int,int);
 
int A[2001],m[2001];
 
int n;
 
int main(){
  int i,j,q;
 
  scanf("%d", &n);
  for(i=0; i<n; i++) {
    scanf("%d", &A[i]);
  }
  scanf("%d",&q);
  for(i=0; i<q; i++) {
    scanf("%d", &m[i]);
  }
 
  for(i=0;i<q;i++){
    if(sol(0,m[i]))printf("yes\n");
    else printf("no\n");
  }
  
  return 0;
}
 
int sol(int x, int y){
 
  if(A[x] == y)return 1;
 
  if(x+1  == n)return 0;
 
  if(sol(x+1,y-A[x]) || sol(x+1,y))return 1;
  return 0;
 }
Compile Error Logs:
You are not authorized to see the message.

ステータス
Judge: 10/10 	C 	CPU: 00.30 sec 	Memory: 584 KB 	Length: 472 B 	2015-05-15 09:49 	2015-05-15 09:49
テストケースの判定結果
Case # 	Verdict 	CPU Time 	Memory 	In 	Out 	Case Name
Case #1: 	: Accepted 	00.00 sec 	584 KB 	45 B 	36 B 	test_case_1
Case #2: 	: Accepted 	00.00 sec 	584 KB 	68 B 	73 B 	test_case_2
Case #3: 	: Accepted 	00.00 sec 	584 KB 	356 B 	374 B 	test_case_3
Case #4: 	: Accepted 	00.00 sec 	584 KB 	319 B 	398 B 	test_case_4
Case #5: 	: Accepted 	00.00 sec 	584 KB 	342 B 	399 B 	test_case_5
Case #6: 	: Accepted 	00.00 sec 	584 KB 	321 B 	343 B 	test_case_6
Case #7: 	: Accepted 	00.00 sec 	584 KB 	402 B 	375 B 	test_case_7
Case #8: 	: Accepted 	00.00 sec 	584 KB 	435 B 	322 B 	test_case_8
Case #9: 	: Accepted 	00.04 sec 	584 KB 	493 B 	336 B 	test_case_9
Case #10: 	: Accepted 	00.30 sec 	584 KB 	950 B 	680 B 	test_case_10
< prev | 	1 	/ 	10 	| next > 	  		 : Accepted        00.00 sec        584 KB
 
Judge Input #1 ( in1.txt | 45 B) 		Judge Output #1 ( out1.txt | 36 B)

5
1 5 7 10 21
10
2 4 6 15 17 8 22 21 100 35 

		

no
no
yes
yes
yes
yes
yes
yes
no
no

Comments
 
 工事中です。
 
Categories
 
 
Free Tags
 
 

Compiler output:
main.c:38:1: error: unknown type name 'Compile'
   38 | Compile Error Logs:
      | ^~~~~~~
main.c:38:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Logs'
   38 | Compile Error Logs:
      |               ^~~~
main.c:42:84: error: invalid digit "9" in octal constant
   42 | Judge: 10/10    C       CPU: 00.30 sec  Memory: 584 KB  Length: 472 B   2015-05-15 09:49        2015-05-15 09:49
      |                                                                                    ^~
main.c:42:108: error: invalid digit "9" in octal constant
   42 | Judge: 10/10    C       CPU: 00.30 sec  Memory: 584 KB  Length: 472 B   2015-05-15 09:49        2015-05-15 09:49
      |                                                                                                            ^~
main.c:44:6: error: stray '#' in program
   44 | Case #  Verdict         CPU Time        Memory  In      Out     Case Name
      |      ^
main.c:45:6: error: stray '#' in program
   45 | Case #1:        : Accepted      00.00 sec       584 KB  45 B    36 B    test_case_1
      |      ^
main.c:46:6: error: stray '#' in program
   46 | Case #2:        : Accepted      00.00 sec       584 KB  68 B    73 B    test_case_2
      |      ^
main.c:47:6: error: stray '#' in program
   47 | Case #3:        : Accepted      00.00 sec       584 KB  356 B   374 B   test_case_3
      |      ^
main.c:48:6: error: stray '#' in program
   48 | Case #4:        : Accepted      00.00 sec       584 KB  319 B   398 B   test_case_4
      |      ^
main.c:49:6: error: stray '#' in program
   49 | Case #5:        : Accepted      00.00 sec       584 KB  342 B   399 B   test_case_5
      |      ^
main.c:50:6: error: stray '#' in program
   50 | Case #6:        : Accepted      00.00 sec       584 KB  321 B   343 B   test_case_6
      |      ^
main.c:51:6: error: stray '#' in program
   51 | Case #7:        : Accepted      00.00 sec       584 KB  402 B   375 B   test_case_7
      |      ^
main.c:52:6: error: stray '#' in program
   52 | Case #8:        : Accepted      00.00 sec       584 KB  435 B   322 B   test_case_8
      |      ^
main.c:53:6: error: stray '#' in program
   53 | Case #9:        : Accepted      00.04 sec       584 KB  493 B   336 B   test_case_9
      |      ^
main.c:54:6: error: stray '#' in program
   54 | Case #10:       : Accepted      00.30 sec       584 KB  950 B   680 B   test_case_10
      |      ^
main.c:57:13: error: stray '#' in program
   57 | Judge Input #1 ( in1.txt | 45 B)                Judge Output #1 ( out1.txt | 36 B)
      |             ^
main.c:57:62: error: stray '#' in program
   57 | Judge Input #1 ( in1.txt | 45 B)                Judge Output #1 ( out1.txt | 36 B)
      |                                                              ^
main.c:79:12: error: stray '\343' in program
   79 |  <U+5DE5><U+4E8B><U+4E2D><U+3067><U+3059><U+3002>
      |                                          ^~~~~~~~