結果
| 問題 |
No.369 足し間違い
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-07 09:36:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 608 bytes |
| コンパイル時間 | 1,791 ms |
| コンパイル使用メモリ | 158,280 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 09:50:53 |
| 合計ジャッジ時間 | 3,420 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
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の解答の入力
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#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;
}