F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20612314_21925.cpp:5:5: error: 'b' does not name a type
     b;}int main(){    int n,k,MAXK;    int sum,ans;    int i,j,cnt;    while(scanf("%d%d%d",&n,&k,&MAXK)!=EOF)    {        ans=0;        for(i=0;i<n;i++)            scanf("%d%d",&girl[i].s,&girl[i].t);        sort(girl,girl+n);        for(i=0;i<n;i++)        {            tmp[0]=girl[i].t;            for(j=i+1,cnt=1;j<n;j++)                if(girl[j].s-girl[i].s<=MAXK)                    tmp[cnt++]=girl[j].t;            if(cnt<k)                continue;            sort(tmp,tmp+cnt,cmp);            for(sum=j=0;j<cnt&&j<k;j++)                sum+=tmp[j];            if(j==k && sum>ans)                ans=sum;        }        printf("%d\n",ans==0?-1:ans);    }}
     ^
0_0_20612314_21925.cpp:5:7: error: expected declaration before '}' token
     b;}int main(){    int n,k,MAXK;    int sum,ans;    int i,j,cnt;    while(scanf("%d%d%d",&n,&k,&MAXK)!=EOF)    {        ans=0;        for(i=0;i<n;i++)            scanf("%d%d",&girl[i].s,&girl[i].t);        sort(girl,girl+n);        for(i=0;i<n;i++)        {            tmp[0]=girl[i].t;            for(j=i+1,cnt=1;j<n;j++)                if(girl[j].s-girl[i].s<=MAXK)                    tmp[cnt++]=girl[j].t;            if(cnt<k)                continue;            sort(tmp,tmp+cnt,cmp);            for(sum=j=0;j<cnt&&j<k;j++)                sum+=tmp[j];            if(j==k && sum>ans)                ans=sum;        }        printf("%d\n",ans==0?-1:ans);    }}
       ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-29 19:13:27, Gzip enabled