結果

問題 No.143 豆
ユーザー akakimidori
提出日時 2015-07-27 01:20:30
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 261 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 20,352 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:20:56
合計ジャッジ時間 747 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d%d%d",&k,&n,&f);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d",&t);
      |                 ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

#define MOD(m) ((m)%1000007)

int main(void){

	int k,n,f;
	scanf("%d%d%d",&k,&n,&f);
	int sum=0;
	while(f>0){
		int t;
		scanf("%d",&t);
		sum+=t;
		f--;
	}
	if(k*n<sum){
		printf("-1\n");
	} else {
		printf("%d\n",k*n-sum);
	}
	return 0;
}
0