結果

問題 No.143 豆
ユーザー PraiPrai
提出日時 2018-02-16 23:42:53
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 29,736 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 11:49:10
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

int main(int argc, char const *argv[])
{	
	int K;
	int N;
	int F;
	int Af[F];

	int sum_bean;
	int sum_age;


	printf("一袋何粒ですか?\n");
	printf("何袋ですか?\n");
	printf("何人家族ですか?\n");
	scanf("%d %d %d",&K,&N,&F);
	printf("それぞれの年齢は?\n");

	for (int i = 0; i < F; ++i)
	{
		scanf("%d",&Af[i]);
	}

	sum_bean=K*N;
	for (int i = 0; i < F; ++i)
	{
		sum_age+=Af[i];
	}

	if(sum_bean/sum_age>0){
		sum_bean-=sum_age;
		printf("%d\n",sum_bean);
	}else{
		printf("-1\n");
	}


	return 0;
}
0