USACO 1.2-Name That Number
2010-06-21 14:00
495 查看
题目
依次读入字典文件中的名字然后判断是否可行,
首先是名字的长度,然后依次判断各位是否合法,不合法直接跳过,合法则输出。
如果total为0则输出NONE。
代码如下:
依次读入字典文件中的名字然后判断是否可行,
首先是名字的长度,然后依次判断各位是否合法,不合法直接跳过,合法则输出。
如果total为0则输出NONE。
代码如下:
{ ID:asdcyt01 PROB:namenum LANG:PASCAL } program namenum(input,output); var n,i,total:longint; data:text; ch:array[1..12]of integer; str:string; flag:boolean; c:char; begin assign(input,'namenum.in');reset(input); assign(output,'namenum.out');rewrite(output); assign(data,'dict.txt');reset(data); n:=0; total:=0; while not eoln do begin inc(n); read(c); ch :=ord(c)-ord('0'); end; while not eof(data) do begin readln(data,str); if length(str)<>n then continue; flag:=false; for i:=1 to n do case ch[i] of 2:if (str[i]<>'A')and(str[i]<>'B')and(str[i]<>'C')then begin flag:=true;break;end; 3:if (str[i]<>'D')and(str[i]<>'E')and(str[i]<>'F')then begin flag:=true;break;end; 4:if (str[i]<>'G')and(str[i]<>'H')and(str[i]<>'I')then begin flag:=true;break;end; 5:if (str[i]<>'J')and(str[i]<>'K')and(str[i]<>'L')then begin flag:=true;break;end; 6:if (str[i]<>'M')and(str[i]<>'N')and(str[i]<>'O')then begin flag:=true;break;end; 7:if (str[i]<>'P')and(str[i]<>'R')and(str[i]<>'S')then begin flag:=true;break;end; 8:if (str[i]<>'T')and(str[i]<>'U')and(str[i]<>'V')then begin flag:=true;break;end; 9:if (str[i]<>'W')and(str[i]<>'X')and(str[i]<>'Y')then begin flag:=true;break;end; end; if flag then continue; writeln(str); inc(total); end; if total=0 then writeln('NONE'); close(input);close(output); end .
相关文章推荐
- USACO Section 1.2 Name That Number 解题报告
- usaco 1.2 Name That Number(数字字母转化)
- USACO section1.2 Name That Number
- USACO 1.2-Name That Number
- USACO Section 1.2 : Name That Number
- 【多文件操作】【检索】Name That Number (Usaco_Training 1.2)
- 【USACO-Chapter1-1.2】【模拟】Name That Number
- USACO 1.2 Name That Number
- USACO 1.2 Name That Number
- USACO Section 1.2 Name That Number
- USACO 1.2 - Name That Number(杂题)
- USACO 1.2 Name That Number (AD-hoc)
- 【USACO 1.2】Name That Number
- 10.8做题——USACO1.2命名那个数字(Name That Number)
- USACO 1.2 Name That Number
- USACO 1.2 Name That Number (namenum)
- USACO 1.2 Problem 3 Name That Number
- USACO--1.2Name That Number
- 【多文件操作】【检索】Name That Number (Usaco_Training 1.2)
- USACO Section 1.2 Name That Number