|
|
back to boardI think program is ok, but I got WA#1 Posted by Zashi 8 Apr 2011 03:26 #include<iostream> using namespace std; int main(){ int n,y=100001; int x=0; cin >> n;
int *array = new int[n];
for( int i=0; i<n; i++ ) { cin >> array[i]; }
for (int i=0; i<n; i++) { x = (array[i+1] - array[i]); if(x < y && x >= 0) { y = x; } }
cout << y; system("PAUSE"); return 0; }
---------------------------------------------------------------- Why WA#1? I got 3 for: 5 5 8 13 27 14
So? Does someone know? I think program is ok, but I got WA#1 Posted by Lock 5 Oct 2011 02:15 WA - Wrong Algorithm |
|
|