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_20614377_27020.cpp:16:5: error: 'b' does not name a type
     b;};int a[1004];int b[2];int main(){    int t,n,mark;    cin>>t;    while(t--)    {        mark=0;        cle(a);        cin>>n;        for(int i=1;i<=n;i++)            cin>>a[i];        sort(a+1,a+n+1);        cle(b);        int j=0;        for(int i=n-1;i>=1;i--)        {                if(a[i+1]-a[i]==3)                {                    mark=1;cout<<a[i]+1<<" "<<a[i]+2<<endl;break;                }                if(a[i+1]-a[i]==2)                {                    b[j++]=a[i]+1;                }                if(a[i+1]-a[i]==1)continue;        }        if(j==2)        {            cout<<b[1]<<" "<<b[0]<<endl;        }        else if(j==0&&!mark)        {            if(a[1]>2)cout<<a[1]-2<<" "<<a[1]-1<<endl;            else cout<<a[n]+1<<" "<<a[n]+2<<endl;        }        else if(j==1)        {            if(a[1]>1)cout<<a[1]-1<<" "<<b[0]<<endl;            else cout<<b[0]<<" "<<a[n]+1<<endl;        }    }    return 0;}
     ^
0_0_20614377_27020.cpp:16:7: error: expected declaration before '}' token
     b;};int a[1004];int b[2];int main(){    int t,n,mark;    cin>>t;    while(t--)    {        mark=0;        cle(a);        cin>>n;        for(int i=1;i<=n;i++)            cin>>a[i];        sort(a+1,a+n+1);        cle(b);        int j=0;        for(int i=n-1;i>=1;i--)        {                if(a[i+1]-a[i]==3)                {                    mark=1;cout<<a[i]+1<<" "<<a[i]+2<<endl;break;                }                if(a[i+1]-a[i]==2)                {                    b[j++]=a[i]+1;                }                if(a[i+1]-a[i]==1)continue;        }        if(j==2)        {            cout<<b[1]<<" "<<b[0]<<endl;        }        else if(j==0&&!mark)        {            if(a[1]>2)cout<<a[1]-2<<" "<<a[1]-1<<endl;            else cout<<a[n]+1<<" "<<a[n]+2<<endl;        }        else if(j==1)        {            if(a[1]>1)cout<<a[1]-1<<" "<<b[0]<<endl;            else cout<<b[0]<<" "<<a[n]+1<<endl;        }    }    return 0;}
       ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2025 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2025-02-17 09:16:24, Gzip enabled