Compile Error
foo.cc: In function 'int main()': foo.cc:17:5: error: expected initializer before 'if' 17 | if(x<0) l_o++; | ^~ foo.cc:27:23: error: 'e' was not declared in this scope 27 | if (x%2 == 0) e.push_back(x); | ^ foo.cc:29:23: error: 'e' was not declared in this scope 29 | if (y%2 == 0) e.push_back(y); | ^ foo.cc:31:23: error: 'e' was not declared in this scope 31 | if (z%2 == 0) e.push_back(z); | ^ foo.cc:35:20: error: 'e' was not declared in this scope 35 | else cout<<e[0]; | ^
Code
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
int main()
{
fast
/*ll t;
cin>>t;
while(t--) solve*/
int x, y, z;
cin>>x>>y>>z;
int l_o = 0;
vector <int> o, e
if(x<0) l_o++;
if (y<0) l_o++;
if (z<0) l_o++;
if (l_o == 1){
if (x<0) cout<<x<<endl;
else if (y<0) cout<<y<<endl;
else if (z<0) cout<<z<<endl;
}
else {
if (x%2 == 0) e.push_back(x);
else o.push_back(x);
if (y%2 == 0) e.push_back(y);
else o.push_back(z);
if (z%2 == 0) e.push_back(z);
else o.push_back(z);
if (o.size() == 1) cout<<o[0];
else cout<<e[0];
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1232 Parity
- Contest
- LUCC Presents Kick & Code Intra LU Programming Contest
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-09-01 05:32:00
- Judged At
- 2025-09-01 05:32:00
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes