Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
让我想不明白的WA,有哪位牛人提供一组测试数据,多谢啦~?#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator