結果
問題 |
No.10 +か×か
|
ユーザー |
![]() |
提出日時 | 2015-07-27 01:53:30 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 465 bytes |
コンパイル時間 | 410 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 8,092 KB |
最終ジャッジ日時 | 2024-07-16 03:51:03 |
合計ジャッジ時間 | 6,834 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 TLE * 1 -- * 7 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:19:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d%d",&N,&total); | ^~~~~~~~~~~~~~~~~~~~~~~ main.c:23:26: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | for(i=0;i<N;i++) scanf("%d",&A[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int dfs(int now,int total,int *A,int num,char *s){ if(num==0){ s[0]='\0'; return now==total; } if(now>total) return 0; s[0]='+'; int res=dfs(now+A[0],total,A+1,num-1,s+1); if(res) return 1; s[0]='*'; return dfs(now*A[0],total,A+1,num-1,s+1); } int main(void){ int N,total; scanf("%d%d",&N,&total); int A[50]; int i; for(i=0;i<N;i++) scanf("%d",&A[i]); char s[55]; dfs(A[0],total,A+1,N-1,s); printf("%s\n",s); return 0; }