Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- long long int a,b=0,c=0,d,e,f=0,g=0;
- scanf("%lld", &d);
- long long int x[d],y[d];
- for(a=0; a<d; a++)
- {
- scanf("%lld", &x[a]);
- }
- for(a=0; a<d; a++)
- {
- if(x[a]%2!=0)
- {
- c++;
- y[a]=x[a]-1;
- b+=y[a];
- }
- else
- {
- f++;
- break;
- }
- }
- //printf("%d ",c);
- if(f==1)
- {
- c++;
- if(c==1)
- {
- b--;
- for(e=c-1; e<d; e++)
- {
- b+=x[e];
- }
- }
- else
- {
- for(a=c-1;a>=0; a--)
- {
- if(y[a]>0)
- {
- b--;
- }
- }
- //printf("%d ",b);
- for(e=c-1; e<d; e++)
- {
- b+=x[e];
- }
- }
- }
- //if(g==0){printf("%lld %lld\n",c,b);}
- printf("%lld %lld\n",c,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement