結果

問題 No.99 ジャンピング駒
ユーザー shialt
提出日時 2014-12-10 21:26:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 55,364 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-11 20:32:44
合計ジャッジ時間 948 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#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)
		return N - 2 * count;
	else
		return 2 * count - N;
}
0