竞赛讨论区 > C 俏兔子大战傻贼鹰(56.25%处样例是不是错了)
头像
MaxTokey
发布于 2019-11-17 18:58
+ 关注

C 俏兔子大战傻贼鹰(56.25%处样例是不是错了)

第三题  是什么鬼  我麻将 读入用的  int char就一直WR 比赛完改代码 最后发现  同学用的 char  char 就对了  
这是不是 官方问题 我做这个题  火很大  我题干读了 不下10遍
第一遍 理解是对的 后面直接 曲解题意了 
我开始考虑  花色 问题 开了 set卡限制  7对是必须 2个 花色
还是不对 有考虑 是不是 允许 7对时 允许  1w1w1w1w这种出现
或者是这两种 同时满足 
我的天呢  
到底是什么鬼   
第一次  代码WR
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<queue>
using namespace std;
queue<int> q;
map<char,int> mp;
int sum[10][4];
int main(){
 int t;
mp['W']=0;
mp['S']=1;
mp['T']=2;
 while(cin>>t){
     char no;
     cin>>no;
    while(t--){
        int flag=0;
        int san,er;
        san=er=0;
        memset(sum,0,sizeof(sum));
        for(int i=0;i<14;i++){
            int num;
            char str;
            cin>>num>>str;
            if(str==no)
            flag=1;
            if(!sum[num][mp[str]]){
            q.push(num);
            q.push(mp[str]);
            sum[num][mp[str]]++;
            }
            else
            {
                sum[num][mp[str]]++;
            }
        }
        while(!q.empty()){
            int a=q.front();
            q.pop();
            int b=q.front();
            q.pop();
            if(sum[a][b]==2)
            er++;
            if(sum[a][b]==3)
            san++;
        }
        int ff=0;
        if(er==7||(san==4&&er==1))
        ff=1;
        if(!flag&&ff)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
 }
    return 0;
}


AC 代码  
就差在   num的类型上 希望官方 能给出解释 是不是样例错了  ????
还是   我思路根本就是错的
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<queue>
using namespace std;
queue<int> q;
map<char,int> mp;
int sum[10][4];
int main(){
 int t;
mp['W']=0;
mp['S']=1;
mp['T']=2;
 while(cin>>t){
     char no;
     cin>>no;
    while(t--){
        int flag=0;
        int san,er;
        san=er=0;
        memset(sum,0,sizeof(sum));
        for(int i=0;i<14;i++){
            char num;
            char str;
            cin>>num>>str;
            if(str==no)
            flag=1;
            if(!sum[num-'0'][mp[str]]){
            q.push(num-'0');
            q.push(mp[str]);
            sum[num-'0'][mp[str]]++;
            }
            else
            {
                sum[num-'0'][mp[str]]++;
            }
        }
        while(!q.empty()){
            int a=q.front();
            q.pop();
            int b=q.front();
            q.pop();
            if(sum[a][b]==2)
            er++;
            if(sum[a][b]==3)
            san++;
        }
        int ff=0;
        if(er==7||(san==4&&er==1))
        ff=1;
        if(!flag&&ff)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }
 }
    return 0;
}






全部评论

(7) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐