|
|
вернуться в форумWA10? I can not understand, why my program does not run on 10th test. Please help me! program mega; var a:array [1..100] of integer; k,n,i:integer; begin read(k, n); for i:=1 to n do read(a[i]); for i:=1 to n do if a[i]-k>0 then a[i+1]:=a[i+1]+(a[i]-k); if a[n]-k> 0 then writeln(a[n]-k) else write ('0'); end. Re: WA10? Послано Angel 25 фев 2012 22:46 I have the same problem #include "stdafx.h" #include<stdio.h> //#include<conio.h> //#include<math.h> void main() { int k,n,A[100],i; scanf("%d %d", &k, &n); for (i=0; i<n; i++) scanf("%d", &A[i]); for (i=0; i<n; i++) if (A[i]>k) A[i+1]+=(A[i]-k); if (A[n-1]>k) printf("%d", A[n-1]-k); else printf("0"); //getch(); } |
|
|