|
|
вернуться в форумwa #7 Послано Freddy 30 май 2013 23:18 what is test case 7? I think my doing well. #include<stdio.h> int main() { int n,val[1001],pos1=2,pos2=1,sum[1001]; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&val[i]); for(int i=2;i<=n-1;i++) { sum[i]=val[i-1]+val[i]+val[i+1]; } for(int i=2;i<=n-1;i++) { if(sum[i]>=sum[i+1]) { sum[i+1]=sum[i]; pos2++; } else if(sum[i]<sum[i+1]) { pos1+=pos2; pos2=1; } } printf("%d %d",sum[n-1],pos1); } |
|
|