提出 #34896490


ソースコード 拡げる

#include<stdio.h>
#define max(p,q)((p)>(q)?(p):(q))

int dp[10010];
int a[110];
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=0;i<k;i++)scanf("%d",a+i);
	
	for(int i=0;i<=n;i++){
		for(int j=0;j<k;j++){
			if(a[j]>i)break;
			dp[i]=max(dp[i],i-dp[i-a[j]]);
		}
	}

	printf("%d\n",dp[n]);
}

提出情報

提出日時
問題 D - Stones
ユーザ kyopro_friends
言語 C (GCC 9.2.1)
得点 400
コード長 316 Byte
結果 AC
実行時間 7 ms
メモリ 1764 KiB

コンパイルエラー

./Main.c: In function ‘main’:
./Main.c:8:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    8 |  scanf("%d%d",&n,&k);
      |  ^~~~~~~~~~~~~~~~~~~
./Main.c:9:22: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    9 |  for(int i=0;i<k;i++)scanf("%d",a+i);
      |                      ^~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 30
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 1 ms 1672 KiB
hand_02.txt AC 1 ms 1720 KiB
hand_03.txt AC 1 ms 1724 KiB
random_01.txt AC 4 ms 1676 KiB
random_02.txt AC 2 ms 1728 KiB
random_03.txt AC 3 ms 1688 KiB
random_04.txt AC 3 ms 1744 KiB
random_05.txt AC 7 ms 1716 KiB
random_06.txt AC 5 ms 1696 KiB
random_07.txt AC 2 ms 1760 KiB
random_08.txt AC 2 ms 1652 KiB
random_09.txt AC 3 ms 1716 KiB
random_10.txt AC 2 ms 1668 KiB
random_11.txt AC 3 ms 1724 KiB
random_12.txt AC 3 ms 1684 KiB
random_13.txt AC 4 ms 1716 KiB
random_14.txt AC 1 ms 1672 KiB
random_15.txt AC 3 ms 1756 KiB
random_16.txt AC 2 ms 1660 KiB
random_17.txt AC 4 ms 1680 KiB
random_18.txt AC 2 ms 1704 KiB
random_19.txt AC 1 ms 1764 KiB
random_20.txt AC 2 ms 1640 KiB
random_21.txt AC 2 ms 1752 KiB
random_22.txt AC 2 ms 1748 KiB
random_23.txt AC 2 ms 1760 KiB
random_24.txt AC 2 ms 1676 KiB
sample_01.txt AC 1 ms 1632 KiB
sample_02.txt AC 1 ms 1628 KiB
sample_03.txt AC 1 ms 1672 KiB