SHOW:
|
|
- or go back to the newest paste.
1 | #include <iostream> | |
2 | using namespace std; | |
3 | - | int v[100],k=0,n; |
3 | + | int a[100],n; |
4 | - | void f(int li,int ls) |
4 | + | int pare(int st, int dr) |
5 | { | |
6 | - | int lm; |
6 | + | int p1,p2,mij=(st+dr)/2; |
7 | - | if(li==ls) {if(v[li]%2==0) k++;} |
7 | + | if(st==dr) |
8 | - | else |
8 | + | if(a[st]%2==0) |
9 | return 1; | |
10 | - | lm=(li+lm)/2; |
10 | + | else return 0; |
11 | - | f(li,lm); |
11 | + | else |
12 | - | f(lm+1,ls); |
12 | + | { |
13 | p1=pare(st,mij); | |
14 | p2=pare(mij+1,dr); | |
15 | - | main() |
15 | + | return p1+p2; |
16 | } | |
17 | } | |
18 | int main() | |
19 | - | for(i=1;i<=n;i++) cin>>v[i]; |
19 | + | |
20 | - | f(1,n); |
20 | + | |
21 | - | cout<<k; |
21 | + | |
22 | for(i=1;i<=n;i++) cin>>a[i]; | |
23 | cout<<pare(1,n); | |
24 | } |