結果
問題 | No.99 ジャンピング駒 |
ユーザー |
![]() |
提出日時 | 2014-12-10 21:29:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 16 ms / 5,000 ms |
コード長 | 320 bytes |
コンパイル時間 | 400 ms |
コンパイル使用メモリ | 53,992 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-11 20:32:46 |
合計ジャッジ時間 | 987 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d", &tmp); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream> using namespace std; int main(void) { int N; int tmp; int count = 0; scanf("%d", &N); for(int i = 0; i < N; i++) { scanf("%d", &tmp); if(tmp % 2 == 0) count++; } if(N - 2 * count > 0) printf("%d\n", N - 2 * count); else printf("%d\n", 2 * count - N); }