⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p1073.dpr

📁 高手写的所有acm例程 在acm.zju.edu.cn 上的题目的例程
💻 DPR
字号:
PROGRAM p1073;

{$APPTYPE CONSOLE}



VAR
   num,sum  :array[1..60]of integer;
   long :integer;
   ch   :char;
   i    :integer;
   pack,temp :array[0..9]of integer;

FUNCTION check:boolean;
var
   i    :integer;
   add  :integer;
   step :integer;
begin
check:=true;
fillchar(pack,sizeof(pack),0);
for i:=1 to long do
    begin
    sum[i]:=num[i];
    inc(pack[sum[i]]);
    end;
step:=1;
while step<long do
begin
add:=0;
inc(step);
for i:=long downto 1 do
    begin
    add:=sum[i]+num[i]+add;
    sum[i]:=add mod 10;
    add:=add div 10;
    end;
if add=0 then
   begin
   fillchar(temp,sizeof(temp),0);
   for i:=1 to long do inc(temp[sum[i]]);
   for I:=0 to 9 do
       if temp[i]<>pack[i] then
       begin
       check:=false;
       exit;
       end;
   end else
        begin
        if step=long then
                begin
                check:=true;
                end else
                begin
                check:=false;
                exit;
                end;
        end;
end;
end;


BEGIN
while not eof do
      begin
      long:=0;
      while not eoln do
            begin
            read(ch);
            inc(long);
            num[long]:=ord(ch)-48;
            end;
      readln;
      for i:=1 to long do write(num[i]);
      if check then writeln(' is cyclic') else writeln(' is not cyclic');
      end;
END.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -