var a:array[1..100,1..100]of string;
q:array[1..10000]of string;
n,m,k,d:longint;
procedure qs(l,h:longint);
var i,j:longint;
x,t:string;
begin
i:=l;j:=h;
x:=q[(l+h) div 2];
repeat
while q[i]<x do inc(i);
while q[j]>x do dec(j);
if i<=j then
begin
t:=q[i];
q[i]:=q[j];
q[j]:=t;
inc(i);
dec(j);
end;
until i>j;
if i<h then qs(i,h);
if j>l then qs(l,j);
end;
procedure nhap;
var i,j,t:longint;
c:char;
begin
readln(k,n,m);
for t:=1 to k do
for i:=1 to n do
begin
for j:=1 to m do
begin
read(c);
a[i,j]:=a[i,j]+c;
end;
readln;
end;
// for i:=1 to n do
// begin
// for j:=1 to m do write(a[i,j],' ');
// writeln;
// end;
end;
procedure chuyen_1_chieu;
var i,j:longint;
begin
d:=0;
for i:=1 to n do
for j:=1 to m do
begin
inc(d);
q[d]:=a[i,j];
end;
// writeln(d);
end;
procedure giai;
var i,j,s:longint;
begin
chuyen_1_chieu;
qs(1,d);
// for i:=1 to d do
// write(q[i]:8);
S:=0;
for i:=2 to d do
if q[i]<>q[i-1] then inc(s);
writeln(s+1);
end;
begin
assign(input,'BIBOARD.inp');reset(input);
assign(output,'BIBOARD.out');rewrite(output);
nhap;
giai;
close(input);close(output);
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ứ Sáu, 13 tháng 5, 2022
BIBOARD 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.