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