| ||||||||||
| 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 | |||||||||
貌似是最简单的贪心算法,机器时间的那个太水了...贴个代码
#include<iostream>
#include<cstring>
using namespace std;
int corrid[210];
int main(){
int T;
cin>>T;
while(T--){
memset(corrid,0,sizeof(corrid));
int n;
cin>>n;
while(n--){
int a,b;
cin>>a>>b;
if(a>b){
int tmp = a;
a = b;
b = tmp;
}
if(a%2==1)
a++;
a = a/2;
if(b%2==1)
b++;
b = b/2;
while(a<=b){
corrid[a]++;
a++;
}
}
int mx(0);
for(int i=1;i<200;i++)
if(mx<corrid[i])
mx = corrid[i];
cout<<mx*10<<endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator