結果
| 問題 |
No.369 足し間違い
|
| コンテスト | |
| ユーザー |
YoshiRyu
|
| 提出日時 | 2016-11-30 17:26:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 378 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 22,528 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 14:00:36 |
| 合計ジャッジ時間 | 809 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘void Slove()’:
main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:14:9: note: in expansion of macro ‘SF’
14 | SF("%d", &N);
| ^~
main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:18:18: note: in expansion of macro ‘SF’
18 | rep(N) { SF("%d", &tmp); ans += tmp; }
| ^~
main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | #define SF(f,v) scanf(f,v)
| ~~~~~^~~~~
main.cpp:21:9: note: in expansion of macro ‘SF’
21 | SF("%d", &v);
| ^~
ソースコード
#include <cstdio>
// マクロ群
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(n) REP(i,n)
#define SF(f,v) scanf(f,v)
#define PF(f,v) printf(f,v)
// using namespace std;
void Slove()
{
int N, v, ans = 0;
SF("%d", &N);
int tmp;
// Aの
rep(N) { SF("%d", &tmp); ans += tmp; }
// yukiさんの答え
SF("%d", &v);
PF("%d\n", ans - v);
}
int main()
{
Slove();
}
YoshiRyu