結果
問題 | No.10 +か×か |
ユーザー | %20 |
提出日時 | 2017-07-10 23:56:38 |
言語 | C (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 277 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 8,480 KB |
最終ジャッジ日時 | 2024-10-07 07:18:41 |
合計ジャッジ時間 | 6,764 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,816 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 6 ms
6,820 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | N,T,A[50]; | ^ main.c:1:1: warning: type defaults to 'int' in declaration of 'N' [-Wimplicit-int] main.c:1:3: warning: type defaults to 'int' in declaration of 'T' [-Wimplicit-int] 1 | N,T,A[50]; | ^ main.c:1:5: warning: type defaults to 'int' in declaration of 'A' [-Wimplicit-int] 1 | N,T,A[50]; | ^ main.c:2:1: warning: data definition has no type or storage class 2 | d[50]; | ^ main.c:2:1: warning: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:4:1: warning: data definition has no type or storage class 4 | i; | ^ main.c:4:1: warning: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] main.c:5:1: warning: return type defaults to 'int' [-Wimplicit-int] 5 | main(){ | ^~~~ main.c: In function 'main': main.c:6:13: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 6 | for(scanf("%d%d",&N,&T);~scanf("%d",A+i++);); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | N,T,A[50]; main.c:6:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 6 | for(scanf("%d%d",&N,&T);~scanf("%d",A+i++);); | ^~~~~ main.c:6:13: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:39:9: warning: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 39 | puts(s+1); | ^~~~ main.c:39:9: note: include '<stdio.h>' or provide a declaration of 'puts'
ソースコード
N,T,A[50]; d[50]; char s[51]; i; main(){ for(scanf("%d%d",&N,&T);~scanf("%d",A+i++);); d[0]=A[0]; for(i=1;;){ if(s[i]=='\0'){ s[i]='+'; d[i]=d[i-1]+A[i]; if(i==N-1){ if(d[i]==T){ break; } }else if(d[i]<=T){ ++i; continue; } } if(s[i]=='+'){ s[i]='*'; d[i]=d[i-1]*A[i]; if(i==N-1){ if(d[i]==T){ break; } }else if(d[i]<=T){ ++i; continue; } } if(s[i]=='*'){ s[i]='\0'; d[i]=0; --i; } } puts(s+1); }