Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
const fi='gameshow.inp';
fo='gameshow.out';
var f1,f2:text;
a,b:array[1..100]of integer;
n,i,tg,d,s,x,j,vtd,vt:integer;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n);
for i:=1 to n do
read(f1,a[i]);
{----------------------xu-ly------------------}
tg:=0;
for i:=1 to n do
tg:=tg+a[i];
for i:=n downto 1 do
if tg mod i=0 then
begin
d:=0;
s:=0;
x:=tg div i;
for j:=1 to n do
begin
s:=s+a[j];
if s=x then
begin
vt:=j;
inc(d);
b[d]:=vt;
s:=0;
end;
end;
if s=0 then
begin
b[d]:=n;
break;
end;
end;
writeln(f2,x);
writeln(f2,d);
for i:=1 to d do
write(f2,b[i],' ');
close(f1);
close(f2);
end.
var f:text;
s:string;
i,dem,max,dau,cuoi:byte;
begin
assign(f,'xau1.txt'); reset(f);
readln(f,s);
close(f);
assign(f,'xau2.txt'); rewrite(f);
dem:=1; max:=1; dau:=1; cuoi:=1;
for i:=1 to length(s)-1 do
begin
if s[i]=s[i+1] then inc(dem) else dem:=1;
if dem>max then
begin
max:=dem;
cuoi:=i+2;
dau:=cuoi-dem;
end;
end;
write(f,dau,':',cuoi);
close(f);
readln;
end.
Program hotrotinhoc;
const fi='xau1.txt';
fo='xau2.txt';
var
f:text;
s:string;
i,d,c,j:byte;
procedure ip;
begin
assign(f,fi);
reset(f);
read(f,s);
close(f);
end;
procedure out;
begin
assign(f,fo);
rewrite(f);
j:=0;
for i:= 1 to length(s) do
begin
if j=0 then j:=i;
if s[i] <> s[i+1] then
begin
if ((i-j)+1)>((c-d)+1) then
begin
d:=j;
c:=i;
end;
j:=0;
end;
end;
write(f,d,':',c);
close(f);
end;
BEGIN
ip;
out;
END.
16 là đến chữ a không phải chữ c mà. Nếu bạn muốn in ra 16 thì chỉ cần write(f,d,':',c+1);
var n,m,i,j,p,q,k,tam:byte;
a:array[1..100,1..100] of integer;
b:array[1..10000] of integer;
f:text;
function tong(x,y:integer):integer;
var i,j:integer;
begin
tong:=0;
for i:=x to x+p-1 do
for j:=y to y+q-1 do
tong:=tong+a[i,j];
exit(tong);
end;
begin
assign(f,'HCN.inp');reset(f);
readln(f,n,m,p,q);
for i:=1 to n do
begin
for j:=1 to m do read(f,a[i,j]);
readln(f);
end;
close(f);
assign(f,'HCN.out');rewrite(f);
k:=0;
for i:=1 to n-q+1 do
begin
for j:=1 to m-p+1 do
begin
inc(k);
b[k]:=tong(i,j);
end;
end;
for i:=1 to k-1 do
for j:=k downto i+1 do
if b[j]>b[j-1] then
begin
tam:=b[j];
b[j]:=b[j-1];
b[j-1]:=tam;
end;
writeln(f,b[1]+b[2]);
close(f);
readln;
end.