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

Re:让我想不明白的WA,有哪位牛人提供一组测试数据,多谢啦~?

Posted by finalfantasy at 2007-07-30 18:26:47 on Problem 3298
In Reply To:让我想不明白的WA,有哪位牛人提供一组测试数据,多谢啦~? Posted by:finalfantasy at 2007-07-30 17:13:18
> #include "iostream"
> using namespace std;
> 
> void main(){
> 	unsigned t,n,first,next,most,temp,i,j,sum[50];
> 	bool flag;
> 	cin>>t;
> 	for(i=0;i<t;i++){
> 		cin>>n>>first;
> 		most=temp=1,flag=false;
> 		for(j=0;j<n-1;j++){
> 			cin>>next;
> 			if (flag) {
> 				if (first<next) {
> 					temp++;
> 					flag = !flag;
> 				}else{
> 					temp=1;
> 					flag = false;
> 				}
> 			}else{
> 				if (first>next) {
> 					temp++;
> 					flag=!flag;
> 				}else{
> 					temp=1;
> 					flag = false;
> 				}
> 			}
> 			if (most<temp) {
> 				most = temp;
> 			}
> 			first = next;
> 		}
> 		sum[i]=most;
> 	}
> 	for(i=0;i<t;i++)
> 		cout<<sum[i]<<endl;
> }

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