level 5
Stephenliu
楼主
var
n,x,i,j,k,m,p,t:longint;
f,a:array[0..1000002] of longint;
begin
assign(input, *count.in*); reset(input);
assign(output, *count.out*); rewrite(output);
readln(n,x);
t:=1;
for i:=1 to n do f[i]:=i;
for i:=1 to n do
begin
k:=f[i];
while k>=0 do
begin
a[t]:=k mod 10;
if a[t]>=0 then
begin
k:=k div 10;
inc(t);
end;
end;
end;
for i:=1 to t do
if a[i]=x then inc(p);
writeln(p);
close(input); close(output);
end.
2014年11月02日 00点11分
1
n,x,i,j,k,m,p,t:longint;
f,a:array[0..1000002] of longint;
begin
assign(input, *count.in*); reset(input);
assign(output, *count.out*); rewrite(output);
readln(n,x);
t:=1;
for i:=1 to n do f[i]:=i;
for i:=1 to n do
begin
k:=f[i];
while k>=0 do
begin
a[t]:=k mod 10;
if a[t]>=0 then
begin
k:=k div 10;
inc(t);
end;
end;
end;
for i:=1 to t do
if a[i]=x then inc(p);
writeln(p);
close(input); close(output);
end.