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:其实很简单的!

Posted by zk54188 at 2009-10-04 20:30:59 on Problem 1083
In Reply To:其实很简单的! Posted by:810974380 at 2009-07-29 14:44:38
> 
> 把过道分成200份,定义一个整型数组统计每块过道上搬运经过的次数,
> 最后排序,输出最大的次数乘以10即可!
> 
> 
> 
> 如果还不明白,看一下代码吧!A过的!
> 
> #include<iostream>
> #include<algorithm>
> using namespace std;
> int main()
> { int n,num,a[200][2],b[200];
>  cin>>n;
>  while(n--)
>  {cin>>num;
>  for(int m=0;m<200;m++)
> 	 b[m]=0;
>   for(int i=0;i<num;i++)
>   {cin>>a[i][0]>>a[i][1];
>    if(a[i][0]>a[i][1])
>    {int temp=a[i][0];a[i][0]=a[i][1];a[i][1]=temp;}
>   }
>   for(int j=1;j<=200;j++)
> 	for(int k=0;k<num;k++)
>   if((((a[k][0])<=2*j-1)&&((a[k][1])>=2*j-1)||(((a[k][0])<=2*j)&&((a[k][1])>=2*j))))
>   b[j-1]++;
>   sort(&b[0],&b[200]);
>   if(b[199]!=0) cout<<b[199]*10<<endl;
>   else cout<<'10'<<endl;
>  }
>  return 0;
> }

确实啊。。。我是看着分类练习 DP 的题目的。。。于是先入为主的朝那个方向想啊,就把问题复杂化了。。。

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