标签:style blog class c code tar
题意:
模拟题,用字母模拟数字,没有数字代表的则跳过,有数则代表但是连续多组的只输出一个。
具体代码:
#include<iostream> #include<string> #include<cstring> using namespace std; int zimu[26]={0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2}; int main() { string s; while(cin>>s) { int ls=s.length(); for(int i=0;i<ls;i++) { if(zimu[s[i]-‘A‘]==0) continue; else { int num=i; while(1) { if(zimu[s[num]-‘A‘]==zimu[s[num+1]-‘A‘]) num++; else { cout<<zimu[s[num]-‘A‘]; i=num; break; } } } } cout<<endl; } // system("pause"); return 0; }
标签:style blog class c code tar
原文地址:http://www.cnblogs.com/baoluqi/p/3734587.html