|
|
вернуться в форумWhy access violation? #include <iostream.h> int main() { long S,N,Sum; bool X; int A[30000]; cin>>S;cin>>N; Sum=0;X=1; for(long i=1;i<=S;i++)cin>>A[i]; for(long i=S;i>=1;i--) { Sum+=A[i]; if(Sum>S-i+1+N)X=0; } if(X==0) cout<<"NO"; else cout<<"YES"; return 0; } Re: Why access violation? Послано Dilyan 23 июл 2004 04:20 it has to ba int A[30001] not int A[30000] just try it Edited by author 23.07.2004 04:20 Edited by author 23.07.2004 04:20 |
|
|