Name that Num
2016-07-29 23:28
267 查看
/* ID: your_id_here PROG: namenum LANG: C++11 */ #include <iostream> #include <fstream> #include <string> using namespace std; string trans(string in) { string str = in; for (int i = 0; i < str.size(); i++) { char &item = str[i]; switch (item) { case 'A': case 'B': case 'C': item = '2'; break; case 'D': case 'E': case 'F': item = '3'; break; case 'G': case 'H': case 'I': item = '4'; break; case 'J': case 'K': case 'L': item = '5'; break; case 'M': case 'N': case 'O': item = '6'; break; case 'P': case 'R': case 'S': item = '7'; break; case 'T': case 'U': case 'V': item = '8'; break; case 'W': case 'X': case 'Y': item = '9'; break; } } return str; } int main() { ofstream fout ("namenum.out"); ifstream fin ("namenum.in"); ifstream dict ("dict.txt"); int n = 0; string row; fin >> row; string names; while (dict >> names) { string name = trans(names); if (name == row) { fout << names << endl; n++; } } if (n == 0) fout << "NONE" << endl; return 0; }
相关文章推荐
- No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
- 程序开发中的细节一:重视空格的缺失(The JSP specification requires that an attribute name is preceded by whitespace)
- USACO习题:Name That Number
- error: Error retrieving parent for item: No resource found that matches the given name 'android:Wind
- Error retrieving parent for item: No resource found that matches the given name 'Widget.
- Android错误之--Error retrieving parent for item: No resource found that matches the given name 'Theme.A
- No resource found that matches the given name 'Theme.AppCompat.Light
- requires that an attribute name is preceded by whitespace异常总结
- 报错“No resource found that matches the given name 'Theme.AppCompat.Light”-完美解决方案
- USACO 1.2 Name That Number
- USCAO section 1.2 Name That Number
- USACO Name That Number (dfs+字典树)
- No resource found that matches the given name 'android:TextAppearance.Material...'解决办法
- Android 创建项目出现No resource found that matches the given name Theme.AppCompat.Light
- No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse
- No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'
- No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse
- 找不R文件切且报 no resource found that matches the given name(“at ' layout_above ' with value ' @id/text_p'
- ORA-01652:unable to extend temp segment by num in tablespace name
- No resource found that matches the given name 'android:Widget.Material.A解决方案