結果
| 問題 |
No.99 ジャンピング駒
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-01 14:36:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 5,000 ms |
| コード長 | 349 bytes |
| コンパイル時間 | 493 ms |
| コンパイル使用メモリ | 63,648 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 00:02:41 |
| 合計ジャッジ時間 | 1,968 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:20: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
19 | cout << abs(ans) << endl;
| ^
main.cpp:7:12: note: 'ans' was declared here
7 | int n, ans;
| ^~~
ソースコード
#include <iostream>
#include<string>
using namespace std;
using ll = long long int;
int main(void){
int n, ans;
cin >> n;
ll x;
for (int i = 0; i < n; i ++){
cin >> x;
if (x % 2 == 0){
ans ++;
}
else{
ans --;
}
}
cout << abs(ans) << endl;
return 0;
}