Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

救命啊!!到底为什么wa啊??是不是我理解错题意啦???

Posted by smilezhen at 2005-08-19 14:06:39 on Problem 2452
#include <iostream.h>

int main(void){
	int i, j, tmp, n, a, b, sub;
	while(cin >> n){
		a = 0; b = 0; sub = 0; tmp = 0; i = n-1; j = n-1;
		if(n < 1) goto L;
		if(n ==1){
			cin >> a;
			goto L;
		}
		while(n--){
			cin >> b;
			if(b < a || n == 0){
				if( n == 0) tmp = i - n;
				else tmp = i-n-1;
				if(tmp > sub) sub = tmp;
				i = n;
			}
			if(n!=0)a = b;
			else{
				if(a >= b && sub == 1) sub = 0;
			}
		}
L:     if( sub == 0) cout << -1 << endl;
		else cout << sub << endl;
	};
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator