結果

問題 No.143 豆
ユーザー umashika
提出日時 2016-02-02 19:58:22
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 295 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 20,224 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:25:35
合計ジャッジ時間 690 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:11:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%d %d %d",&k,&n,&f);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:13:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d",&a[i]);
      |     ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(void)
{
  int k;
  int n;
  int f;
  int a[1000];
  int i;
  int sum=0;

  scanf("%d %d %d",&k,&n,&f);
  for(i=0;i<f;i++){
    scanf("%d",&a[i]);
    sum+=a[i];
  }
  if(sum<=n*k){
    printf("%d\n",n*k-sum);
  }
  else{
    printf("-1\n");
  }
  return 0;
}









0