团体程序设计天梯赛 https://www.patest.cn/contests/gplt

https://www.patest.cn/contests/gplt

代码:

L2-21
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//
//struct node{
//   char name[10];
//   int k,k2;
//}s[1005];
//int cmp(node s1,node s2)
//{
//    if(s1.k!=s2.k)
//    return s1.k>s2.k;
//    else
//        return s1.k2<s2.k2;
//}
//int main()
//{
//    int n,x[1005],k;
//    char name[10];
//    while(cin>>n){
//
//            getchar();
//    for(int i=0;i<n;i++)
//    {
//        cin>>s[i].name>>s[i].k2;
//        for(int j=0;j<s[i].k2;j++)
//        {
//            cin>>x[j];
//        }
//        sort(x,x+s[i].k2);
//        s[i].k=unique(x,x+s[i].k2)-x;
//        getchar();
//    }
//    sort(s,s+n,cmp);
//   if(n>2) cout<<s[0].name<<" "<<s[1].name<<" "<<s[2].name<<endl;
//   if(n==2) cout<<s[0].name<<" "<<s[1].name<<" "<<"-"<<endl;
//   if(n==1) cout<<s[0].name<<" "<<"-"<<" "<<"-"<<endl;
//
//    }
//    return 0;
//}

L1-41
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//typedef long long ll;
//int main()
//{
//    ll x,vis=0;
//    ll step=1;
//    while(scanf("%lld",&x)!=EOF)
//    {
//        if(x==250&&vis==0){vis++;cout<<step<<endl;}
//        step++;
//    }
//    return 0;
//}

L1-42
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//char yue[2],nian[4],ri[2],fuhao[2];
//int main()
//{
//    while(cin>>yue[0]>>yue[1]>>fuhao[0]>>ri[0]>>ri[1]>>fuhao[1]>>nian[0]>>nian[1]>>nian[2]>>nian[3])
//    {
//        cout<<nian[0]<<nian[1]<<nian[2]<<nian[3]<<fuhao[0]<<yue[0]<<yue[1]<<fuhao[1]<<ri[0]<<ri[1]<<endl;
//    }
//    return 0;
//}


L1-44
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//string s;
//int main()
//{
//    int k;
//    int step=0;
//    cin>>k;
//    getchar();
//    while(cin>>s)
//    {
//
//        if(s=="End")break;
//        step++;
//        if(step%(k+1)!=0){
//        if(s=="Bu")cout<<"JianDao"<<endl;
//        else if(s=="JianDao")cout<<"ChuiZi"<<endl;
//        else if(s=="ChuiZi")cout<<"Bu"<<endl;
//        }
//        if(step%(k+1)==0){
//        cout<<s<<endl;
//        }
//    }
//    return 0;
//}


L1-45
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//char s[10];
//int main()
//{
//    while(cin>>s)
//    {
//        cout<<"Hello "<<s<<endl;
//    }
//    return 0;
//}


L1-46
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//typedef unsigned long long ll;
//int main()
//{
//    ll x,k,step=1;
//    x=1;
//    cin>>k;
//    while(1)
//    {
//        if(x%k==0){cout<<x/k<<" "<<step<<endl;break;}
//        else {x=x*10+1;step++;}
//    }
//    return 0;
//}



L1-47
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//char s[15];
//int main()
//{
//    int n,x,y;
//    cin>>n;
//    while(n--)
//    {
//        cin>>s>>x>>y;
//        if(x<15||x>20||y<50||y>70)cout<<s<<endl;
//    }
//    return 0;
//}

L2-23
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 200005
//using namespace std;
//vector<int>G[505];
//int color[505];
//int k;
//int op[505];
//int n;
//int v,e;
//bool check()
//{
//    for(int i=1;i<=v;i++)
//        for(int j=0;j<G[i].size();j++)
//    {
//        if(color[i]==color[G[i][j]]) return true;
//    }
//    return false;
//}
//int main()
//{
//    cin>>v>>e>>k;
//    for(int i=0;i<e;i++)
//    {
//        int s,t;
//        cin>>s>>t;
//        G[s].push_back(t);
//        G[t].push_back(s);
//    }
//    cin>>n;
//    while(n--)
//    {
//        for(int i=0;i<v;i++)
//        {
//            cin>>op[i];
//            color[i+1]=op[i];
//        }
//        sort(op,op+v);
//        int ans=unique(op,op+v)-op;
//        //cout<<ans<<endl;
//        //cout<<k;
//       if(ans!=k){cout<<"No"<<endl;}
//       else {
//           if(check()){cout<<"No"<<endl;}
//           else cout<<"Yes"<<endl;
//       }
//    }
//    return 0;
//}


L2-24
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<cmath>
//#include<queue>
//#include<set>
//#include<algorithm>
//#include<map>
//#define maxn 100005
//using namespace std;
//int fa[maxn],ranke[maxn];
//void init(int n)
//{
//    for(int i=0;i<n;i++)
//    {
//        fa[i]=i;
//        ranke[i]=1;
//    }
//}
//int find(int x)
//{
//    if(fa[x]==x)return x;
//    else{
//        return fa[x]=find(fa[x]);
//    }
//}
//void unite(int x,int y)
//{
//    x=find(x);
//    y=find(y);
//    if(x==y)return ;
//     if(ranke[x]<ranke[y])
//    {
//        fa[x]=y;
//        ranke[x]+=ranke[y];
//    }
//    else{
//        fa[y]=x;
//        ranke[y]+=ranke[x];
//       if(ranke[x]==ranke[y])ranke[x]++;
//    }
//}
//bool same(int x,int y)  //判断父亲是否相同
//{
//    return find(x)==find(y);
//}
//
//int main()
//{
//    int n,m,k,ans,x,y,mazz;
//    int s[maxn];
//    while(cin>>m){
//    init(10004);
//    if(m==0)return 0;
//    ans=0;mazz=0;
//    while(m--)
//    {
//       cin>>k;
//       for(int i=0;i<k;i++)
//       {
//           cin>>s[i];
//           if(mazz<s[i])mazz=s[i];
//       }
//       for(int i=0;i<k-1;i++)
//       {
//           unite(s[i],s[i+1]);
//       }
//    }
//    for(int i=1;i<=mazz;i++)
//    {
//        if(i==find(i))ans++;
//    }
//    cout<<mazz<<" "<<ans<<endl;
//    cin>>n;
//    for(int j=0;j<n;j++)
//    {
//        cin>>x>>y;
//        if(same(x,y))cout<<"Y"<<endl;
//        else cout<<"N"<<endl;
//    }
//}
//return 0;
//}
原文地址:https://www.cnblogs.com/huangzzz/p/8541221.html