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_20614583_7358.cpp:12:25: error: stray '#' in program
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                         ^
0_0_20614583_7358.cpp:12:26: error: 'define' does not name a type
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                          ^
0_0_20614583_7358.cpp:12:82: error: 'Max' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                                  ^
0_0_20614583_7358.cpp:12:95: error: 'Max' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                                               ^
0_0_20614583_7358.cpp: In function 'void dfs(int)':
0_0_20614583_7358.cpp:12:159: error: 'q' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                                                                                                               ^
0_0_20614583_7358.cpp:12:189: error: 'vis' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                                                                                                                                             ^
0_0_20614583_7358.cpp:12:443: error: 'MOD' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                           ^
0_0_20614583_7358.cpp:12:495: error: 'MOD' was not declared in this scope
     using namespace std;#define Max 100010const int  MOD = 1e9+7;vector <int > q[Max];int vis[Max];long long res=1;int flag=1;int n;void dfs(int a){    int k=q[a].size();    int cnt=0;    vis[a]=1;    for(int i=0;i<k;i++)    {        if(vis[q[a][i]]) continue;        if(q[q[a][i]].size()==1&&vis[q[a][i]]==0) cnt++;        else dfs(q[a][i]);    }    if(a!=1)k--;    if(k-cnt>2){flag=0;return ;}    if(cnt!=k)    {        res*=2;        res%=MOD;    }    while(cnt>0)    {        res*=cnt;res%=MOD;cnt--;    }    //cout<<a<<" "<<res<<endl;    //cout<<res<<endl;}int main(){    int T;    cin>>T;    int _case=0;    while(T--)    {        cin>>n;        flag=1;        for(int i=1;i<=n;i++) q[i].clear();        memset(vis,0,sizeof(vis));        int a,b;        for(int i=1;i<n;i++)        {            scanf("%d %d",&a,&b);            q[b].push_back(a);            q[a].push_back(b);        }        res=2;        if(n!=1)        dfs(1);        else res=1;        if(!flag) res=0;        cout<<"Case #"<<++_case<<": "<<res%MOD<<endl;    }    return 0;}
                                                                        


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-17 01:51:20, Gzip enabled