結果
問題 | No.385 カップ麺生活 |
ユーザー | ciel |
提出日時 | 2018-02-12 00:06:51 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 1,127 ms |
コンパイル使用メモリ | 29,056 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 22:57:03 |
合計ジャッジ時間 | 1,222 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 1 ms
6,820 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | AC | 1 ms
6,816 KB |
testcase_04 | AC | 1 ms
6,820 KB |
testcase_05 | AC | 0 ms
6,820 KB |
testcase_06 | AC | 1 ms
6,820 KB |
testcase_07 | AC | 1 ms
6,816 KB |
testcase_08 | AC | 1 ms
6,820 KB |
testcase_09 | AC | 1 ms
6,820 KB |
testcase_10 | AC | 1 ms
6,816 KB |
testcase_11 | AC | 1 ms
6,816 KB |
testcase_12 | AC | 1 ms
6,816 KB |
testcase_13 | AC | 1 ms
6,816 KB |
testcase_14 | AC | 1 ms
6,816 KB |
testcase_15 | AC | 1 ms
6,820 KB |
testcase_16 | AC | 0 ms
6,816 KB |
testcase_17 | AC | 1 ms
6,816 KB |
testcase_18 | AC | 1 ms
6,816 KB |
testcase_19 | AC | 1 ms
6,820 KB |
testcase_20 | AC | 1 ms
6,820 KB |
testcase_21 | AC | 1 ms
6,816 KB |
testcase_22 | AC | 1 ms
6,820 KB |
testcase_23 | AC | 2 ms
6,816 KB |
testcase_24 | AC | 1 ms
6,816 KB |
testcase_25 | AC | 1 ms
6,820 KB |
testcase_26 | AC | 1 ms
6,820 KB |
testcase_27 | AC | 1 ms
6,820 KB |
testcase_28 | AC | 1 ms
6,820 KB |
testcase_29 | AC | 1 ms
6,820 KB |
testcase_30 | AC | 1 ms
6,816 KB |
testcase_31 | AC | 0 ms
6,820 KB |
testcase_32 | AC | 1 ms
6,820 KB |
testcase_33 | AC | 1 ms
6,820 KB |
testcase_34 | AC | 1 ms
6,816 KB |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | T[10001],A[10001],B[99],k,r;main(){ | ^ main.c:1:1: warning: type defaults to 'int' in declaration of 'T' [-Wimplicit-int] main.c:1:10: warning: type defaults to 'int' in declaration of 'A' [-Wimplicit-int] 1 | T[10001],A[10001],B[99],k,r;main(){ | ^ main.c:1:19: warning: type defaults to 'int' in declaration of 'B' [-Wimplicit-int] 1 | T[10001],A[10001],B[99],k,r;main(){ | ^ main.c:1:25: warning: type defaults to 'int' in declaration of 'k' [-Wimplicit-int] 1 | T[10001],A[10001],B[99],k,r;main(){ | ^ main.c:1:27: warning: type defaults to 'int' in declaration of 'r' [-Wimplicit-int] 1 | T[10001],A[10001],B[99],k,r;main(){ | ^ main.c:1:29: warning: return type defaults to 'int' [-Wimplicit-int] 1 | T[10001],A[10001],B[99],k,r;main(){ | ^~~~ main.c: In function 'main': main.c:3:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 3 | scanf("%d%d",&m,&n); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | T[10001],A[10001],B[99],k,r;main(){ main.c:3:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 3 | scanf("%d%d",&m,&n); | ^~~~~ main.c:3:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:13: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 7 | *B=!printf("%lld\n",r+k); | ^~~~~~ main.c:7:13: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:7:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:7:13: note: include '<stdio.h>' or provide a declaration of 'printf
ソースコード
T[10001],A[10001],B[99],k,r;main(){ int m,n,i,j; scanf("%d%d",&m,&n); for(i=0;i<n;i++)scanf("%d",B+i),A[B[i]]=1; for(i=0;i<n;i++)for(j=0;j<=m-B[i];j++)if(A[j]&&A[j+B[i]]<=A[j])A[j+B[i]]=A[j]+1; for(i=2;i<=m;i++)if(k=k>A[i]?k:A[i],!T[i])for(r+=A[m-i],j=i;j<=m;j+=i)T[j]=1; *B=!printf("%lld\n",r+k); }