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:求解答。。多次提交仍然WRONG啊

Posted by huang7818 at 2012-11-05 13:44:33 on Problem 1083
In Reply To:求解答。。多次提交仍然WRONG啊 Posted by:20116096 at 2012-07-23 10:54:01
> #include<iostream>
> using namespace std;
> 
> 
> int main()
> {  
> 	int M;
>    int max=0;
>    cin>>M;
>    while(M--)
>    {
> 	   int i,n,k,l;       
> 	   int id[201]={0};         //l个需要搬动的桌子,起始n,中止k
> 	   cin>>l;
> 	   while(l--)
> 	   {
> 		   cin>>n>>k;
> 		   if(n>k)
> 		   {
> 			   i=n;n=k;k=i;             //交换小值n在前
> 		   }
>            int start,end;
> 		   if(n%2!=0)start=n/2+1;else start=n/2;
> 		   if(k%2!=0)end=k/2+1;else end=k/2;
> 		   for(i=start;i<=end;i++)
> 			   id[i]++;
> 	       
> 		   
>              
> 	   }
> 	   for(i=0;i<201;i++)
>                if(max<id[i])
> 			   max=id[i];
> 	 cout<<max*10<<endl;  
>    }
>    return 0;
> }
在每个M循环里你的max没有清零

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