Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PARE2:
- #include <iostream>
- #include <vector>
- #include <cmath>
- using namespace std;
- int main(){
- int n;
- bool trobat, parell, senar;
- while(cin >> n){
- trobat = parell = senar = false;
- vector <int> v(n);
- for(int i = 0; i < n; ++i) cin >> v[i];
- for(int i = 0; i < n and not trobat; ++i){
- if(v [i] % 2 == 0) parell = true;
- else senar = true;
- if(parell and senar) trobat = true;
- }
- if(trobat) cout << "si" << endl;
- else cout << "no" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement