結果
| 問題 |
No.143 豆
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-14 00:42:37 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 253 bytes |
| コンパイル時間 | 264 ms |
| コンパイル使用メモリ | 20,736 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 10:32:11 |
| 合計ジャッジ時間 | 823 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d %d",&k,&n,&f);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&age[i]);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void){
int k,n,f,i,sum=0,ans=0;
scanf("%d %d %d",&k,&n,&f);
int age[f];
for(i=0;i<f;i++){
scanf("%d",&age[i]);
sum += age[i];
}
if(sum > k*n) ans = -1;
else ans = k*n - sum;
printf("%d\n",ans);
return 0;
}