本文共 940 字,大约阅读时间需要 3 分钟。
思路:用map映射。我的代码用g++TLE,用c++由于没分清cstring和string一直CE。
#include #include #include #include using namespace std;#define ll long long#define pb push_back#define mem(a,b) memset((a),(b),sizeof(a))#define MAX(a,b,c) max(a,max(b,c))map mp;map Mp;int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; mp['A']='2',mp['B']='2',mp['C']='2'; mp['D']='3',mp['E']='3',mp['F']='3'; mp['G']='4',mp['H']='4',mp['I']='4'; mp['J']='5',mp['K']='5',mp['L']='5'; mp['M']='6',mp['N']='6',mp['O']='6'; mp['P']='7',mp['R']='7',mp['S']='7'; mp['T']='8',mp['U']='8',mp['V']='8'; mp['W']='9',mp['X']='9',mp['Y']='9'; cin>>t; while(t--) { string s; cin>>s; string ans; int cnt=0; bool flag=true; for(int i=0;i ::iterator it=Mp.begin(); while(it!=Mp.end()) { if(it->second>1)flag=false,cout< first<<' '< second<
转载于:https://www.cnblogs.com/widsom/p/7307017.html