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 callmelili at 2013-08-02 19:37:30 on Problem 2459
In Reply To:求指教哪里错了!!! Posted by:771385494 at 2011-12-13 09:45:02
F1怎么可能小于F2。
> #include <iostream>
> using namespace std;
> int main()
> {
> 	long int C,F1,F2,D,array[100][2],i,j;
> 	while(scanf("%ld %ld %ld %ld",&C,&F1,&F2,&D) != EOF){
> 		int map[2000] = {0};
> 		for(i = 0; i < C; i++)
> 		{
> 			cin >> array[i][0] >> array[i][1];
> 			for(j = array[i][0]; j <= array[i][1]; j++)
> 				map[j]++;
> 		}
> 		for(i = D; i >= 0; i--)
> 		{
> 			F1 -= map[i];
> 			if(F1 <= F2)
> 				break;
> 		}
> 		if(i == D)
> 			cout << i << endl;
> 		else if(F1 == F2)
> 			cout << i << endl;
> 		else if(F1 < F2)
> 			cout << i + 1 << endl;
> 	}
> 	return 0;
> }

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