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:16MS水过……

Posted by treert at 2010-10-18 09:08:08 on Problem 3663 and last updated at 2010-10-18 09:10:14
In Reply To:16MS水过…… Posted by:sogo at 2010-02-25 19:53:02
> #include"stdio.h"
> #include"algorithm"
> using namespace std;
> int main()
> {
> 	int n,s,t,i,j;
> 	int a[20002];
> 	int count=0;
> 	scanf("%d%d",&n,&s);
> 	for(i=0;i<n;i++)
> 		scanf("%d",&a[i]);
> 	sort(a,a+n);
> 	j=n-1;
> 	for(i=0;i<n-1;i++)
> 	{
> 		if(a[i]>=s) break;
> 		while(a[i]+a[j]>s)
> 			j--;。。。。。。。。。。。。。精
> 		if(j<=i)
> 			break;
> 			count+=(j-i);
> 	}
> 	printf("%d\n",count);
> 	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