⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1567.cpp

📁 杭电 acm部分代码 有兴趣的可以下载 谢谢
💻 CPP
字号:
#include<stdio.h>
int table[2010][2010],hash[2010];
int num;
int main()
{
    int i,j,a,b;
    bool ok;
    while(scanf("%d",&num)==1){
        for(i=1;i<=num;i++)
            for(j=1;j<=num;j++)
                table[i][j]=0;
        ok=true;
        for(i=1;i<num;i++){
            for(j=1;j<=num;j++)
                hash[j]=0;
            for(j=1;j<=num/2;j++){
                scanf("%d-%d",&a,&b);
                hash[a]++,hash[b]++;
                if(a==b||a>num||b>num)
                    ok=false;
                table[a][b]++,table[b][a]++;
                if(table[a][b]!=1||table[b][a]!=1)
                    ok=false;
            }
            for(j=1;j<=num;j++)
                if(hash[j]!=1)
                    ok=false;
        }
        if(ok==true)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -