noip2013普及组的第一题,不知道为什么运行错误
pascal吧
全部回复
仅看楼主
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
level 12
字符串无压力啊亲
2014年11月02日 01点11分 2
level 4
var
x,i:longint;
procedure init;
begin
assign(input,*prime.in*);
reset(input);
assign(output,*prime.out*);
rewrite(output);
end;
procedure outit;
begin
close(input);
close(output);
end;
procedure main;
begin
readln(x);
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then
begin
write(x div i);
outit;
halt;
end;
end;
begin
init;
main;
outit;
end.
2014年11月06日 10点11分 4
1