crypt1.pas
来自「Magio牛的usaco源代码」· PAS 代码 · 共 54 行
PAS
54 行
{
ID:maigoak1
PROG:crypt1
}
program crypt1;
var
fin,fout:text;
d:array[1..9]of integer;
e:array[0..9]of boolean;
n,a1,a2,a3,b1,b2,a,b,count,i:integer;
function len(x:integer):integer;
var
s:string;
i:integer;
begin
str(x,s);
len:=length(s);
for i:=1 to len do
if not e[ord(s[i])-48] then begin
len:=0;
exit;
end;
end;
begin
fillchar(e,sizeof(e),0);
assign(fin,'crypt1.in');
reset(fin);
readln(fin,n);
for i:=1 to n do begin
read(fin,d[i]);
e[d[i]]:=true;
end;
close(fin);
count:=0;
for a1:=1 to n do
for a2:=1 to n do
for a3:=1 to n do begin
a:=(d[a1]*10+d[a2])*10+d[a3];
for b1:=1 to n do
if len(a*d[b1])=3 then
for b2:=1 to n do begin
b:=d[b1]*10+d[b2];
if (len(a*d[b2])=3) and (len(a*b)=4) then inc(count);
end;
end;
assign(fout,'crypt1.out');
rewrite(fout);
writeln(fout,count);
close(fout);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?