字符输入问题
求助大佬
#include<bits/stdc++.h> using namespace std; typedef long long ll; map<char,map<int,int> >p; set<char>q; set<char> ::iterator itq; int main() { int t; int x; char a; while(cin>>t){ char c; cin>>c; while(t--){ for(int i=0;i<14;i++) cin>>x>>a,p[a][x]++,q.insert(a); if(q.size()==3){cout<<"No"<<endl;q.clear(),p.clear();} else { int now=0,next=0; for(itq=q.begin();itq!=q.end();itq++){ char b=*(itq); if(b==c){ now=0;break; } for(int i=1;i<=9;i++){ if(p[b][i]==2)now++; else if(p[b][i]==3)next++; } } if(now==7||(next==4&&now==1))cout<<"Yes"<<endl; else cout<<"No"<<endl; q.clear(); p.clear(); } } } } 问题就在cin>>x>>a这里,改成string s; cin>>s; for(int i=0;i<14;i++) p[s[2*i+1]][s[2*i]-'0']++,q.insert(s[2*i+1]); 就行,感觉没啥差别啊