結果
問題 | No.99 ジャンピング駒 |
ユーザー |
![]() |
提出日時 | 2019-02-04 03:46:37 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 14 ms / 5,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 395 ms |
コンパイル使用メモリ | 23,936 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 12:39:41 |
合計ジャッジ時間 | 1,042 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &in); | ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h>#include <stdlib.h>int main(){int n;scanf("%d", &n);int evn = 0;int odd = 0;int in;for(int i = 0; i < n; i++){scanf("%d", &in);if((in % 2) == 0)evn++;elseodd++;}int ans = abs(evn - odd);printf("%d\n", ans);return 0;}