📄 ac1102.pas
字号:
program tju1102;
const
maxn=20000;
var
a:array[1..maxn]of word;
n,i,t,u,op,len,maxlen:word;
begin
repeat
read(n);
for i:=1 to n do
read(a[i]);
op:=n;maxlen:=0;
for i:=1 to n do
if a[i]>0 then begin
dec(op);
t:=i;len:=0;
repeat
u:=a[t];a[t]:=0;inc(len);t:=u;
until a[t]=0;
if len>maxlen then maxlen:=len;
end;
write(op,' ');
case maxlen of
1:writeln(0);
2:writeln(1);
else writeln(2);
end;
until seekeof;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -