#include<iostream> #include<math.h> using namespace std; #ifdef KICIA #define DEBUG(x) x #else #define DEBUG(x) #endif // KICIA int main(){ ios_base::sync_with_stdio(0); long long p = 1000000007, wyn = 0; int n; cin>>n; long long tab[n], sumy[n]; for(int i=0; i<n; ++i){ cin>>tab[i]; } sumy[0] = tab[0]; for(int i=1; i<n; ++i){ sumy[i] = sumy[i-1] + tab[i]; } if(sumy[n-1] > p){ cout<<3; }else{ if(sumy[n-1]%2 == 1){ cout<<0; return 0; } for(int i=0; i<n; ++i){ if(sumy[i]%2 == 0){ wyn++; } } wyn++; cout<<pow(2,(wyn-2)); } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include<iostream> #include<math.h> using namespace std; #ifdef KICIA #define DEBUG(x) x #else #define DEBUG(x) #endif // KICIA int main(){ ios_base::sync_with_stdio(0); long long p = 1000000007, wyn = 0; int n; cin>>n; long long tab[n], sumy[n]; for(int i=0; i<n; ++i){ cin>>tab[i]; } sumy[0] = tab[0]; for(int i=1; i<n; ++i){ sumy[i] = sumy[i-1] + tab[i]; } if(sumy[n-1] > p){ cout<<3; }else{ if(sumy[n-1]%2 == 1){ cout<<0; return 0; } for(int i=0; i<n; ++i){ if(sumy[i]%2 == 0){ wyn++; } } wyn++; cout<<pow(2,(wyn-2)); } return 0; } |