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 |
Why WA?#include <iostream> #include <FSTREAM> using namespace std; struct movingTable{ int even; int odd; int crdr; }; int max=0; movingTable a[201]; void format(void){ int i,k=1; for(i=2;i<=400;i+=2){ a[k].even=i; a[k].odd=i-1; a[k].crdr=0; k++; } max=0; } void main(){ int test; int n,s,t,i; //ifstream in("input.txt"); cin>>test; while(test--){ cin>>n; format(); while(n--){ cin>>s>>t; if(t<s){ int tmp; tmp=s; s=t; t=tmp; } if(s%2==0 && t%2==1) t++; for(i=s;i<=t;i+=2){ a[i/2].crdr++; } } for(i=1;i<=200;i++) if(max<a[i].crdr) max=a[i].crdr; cout<<max*10<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator