var i,n:longint;
d:array[1..10000000] of longint;
t,max1,max0:longint;
procedure nhap;
var i,x:longint;
begin
readln(n);
for i:=1 to n div 2 do //đánh dấu phần tử xuát hiện
begin
readln(x);
inc(d[x]);
end;
end;
procedure tim_max1;
begin
t:=0;max1:=0;
for i:=1 to n do
begin
if d[i]=1 then inc(t)
else t:=0;
if t>max1 then max1:=t;
end;
end;
procedure tim_max0;
begin
t:=0;max0:=0;
for i:=1 to n do
begin
if d[i]=0 then inc(t)
else t:=0;
if t>max0 then max0:=t;
end;
end;
procedure giai;
var i:longint;
begin
tim_max1;
tim_max0;
if max1>max0 then write('DUONG');
if max1=max0 then
if d[n]=1 then write('DUONG')
else write('TUNG');
if max1<max0 then write('TUNG');
end;
begin
assign(input ,'CARD679.INP');reset(input);
assign(output,'CARD679.OUT');rewrite(output);
nhap;
giai;
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Thứ Tư, 27 tháng 4, 2022
CARD679 Pascal
Đăng ký:
Đăng Nhận xét (Atom)
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.