結果

問題 No.369 足し間違い
ユーザー sasakkisasakki
提出日時 2016-05-21 01:02:56
言語 C90
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 291 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 21,888 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 04:35:46
合計ジャッジ時間 1,873 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 WA -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |   scanf("%d", &num);
      |   ^~~~~~~~~~~~~~~~~
main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d", &array[i]);
      |     ^~~~~~~~~~~~~~~~~~~~~~
main.c:15:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   scanf("%f", &ans);
      |   ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
  int num;
  int array[num];
  float ans;

  scanf("%d", &num);
  
  int i;
  for(i = 0; i < num; i++){
    scanf("%d", &array[i]);
  }
  
  scanf("%f", &ans);
  
  for(i = 0; i < num; i++){
    ans -= array[i];
  }

  printf("%.f\n", -ans);
  
  return 0;
}
0