📄 usaco_namenum.cpp
字号:
/*
ID:wangyuc2
PROG:namenum
LANG:C++
*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int a[12];
int i,j,k,c[12];
char s[13],ds[13];
bool find,printed=false;
ifstream fin("namenum.in");
ifstream din("dict.txt");
ofstream fout("namenum.out");
cin>>s;
for(i=0;i<strlen(s);i++) a[i]=s[i]-48;
while(din>>ds)
{
if(strlen(ds)!=strlen(s)) continue;
find=true;
for(i=0;i<strlen(ds);i++)
{
switch(ds[i])
{
case 'A': case 'B': case 'C': c[i]=2;break;
case 'D': case 'E': case 'F': c[i]=3;break;
case 'G': case 'H': case 'I': c[i]=4;break;
case 'J': case 'K': case 'L': c[i]=5;break;
case 'M': case 'N': case 'O': c[i]=6;break;
case 'P': case 'R': case 'S': c[i]=7;break;
case 'T': case 'U': case 'V': c[i]=8;break;
case 'W': case 'X': case 'Y': c[i]=9;break;
}
}
for(i=0;i<strlen(s);i++)
if(a[i]!=c[i]) {find=false;break;}
if(find) {fout<<ds<<endl;printed=true;}
}
if(!printed) fout<<"NONE"<<endl;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -