結果

問題 No.369 足し間違い
ユーザー dai11dai11
提出日時 2017-07-07 09:36:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 608 bytes
コンパイル時間 1,367 ms
コンパイル使用メモリ 156,764 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 01:11:22
合計ジャッジ時間 1,989 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |   scanf("%d",&N);       //入力
      |   ~~~~~^~~~~~~~~
main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |     scanf("%d",&atai);  //足し算される値を入力
      |     ~~~~~^~~~~~~~~~~~
main.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |   scanf("%d",&kaitou);  //yukiの解答の入力
      |   ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char **argv) 
{
  int i = 0;            //ループカウンタ
  int N = 0;            //N個の数値
  int atai = 0;         //足し算される値
  int kaitou = 0;       //yukiの解答
  int total = 0;        //足し算される値の合計
  scanf("%d",&N);       //入力
  
  for(i=0;i<N;i++)      //N回ループ
  {
    scanf("%d",&atai);  //足し算される値を入力
    total +=atai;       //足し算される値の合計
  }
  scanf("%d",&kaitou);  //yukiの解答の入力
  printf("%d\n",total-kaitou);

  return 0;
}
0