| ||||||||||
| 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 | |||||||||
Re:16MS水过……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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator