Thứ Tư, 27 tháng 4, 2022

LUYTHUA PASCAL

var     n,k:longint;
        xh:array[0..100] of boolean;
function luythua(n,k:longint):longint;
var s,i:longint;
begin
    s:=1;
    for i:=1 to k do
          s:=((s mod 100)*(n mod 100)) mod 100;
    exit(s);
end;
procedure giai;
begin
        repeat
        n:=luythua(n,k);
             if xh[n] then exit;
           xh[n]:=true;
          write(n,' ');
        until 1>2;
end;
procedure nhap;
begin
        read(n,k);
end;
begin
        assign(input,'luythua.inp');reset(input);
        assign(output,'luythua.out');rewrite(output);
        nhap;
        giai;
end.

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.