175 条题解
-
0mintalfance LV 10 @ 2009-09-07 21:20:25
program p1199;
var a:array[1..100,1..100] of longint;
i,j,k,l,m,n,max:longint;
t:char;
function sum(x,y:longint):longint;
var g,t,s:longint;
begin
s:=0;
for g:=0 to m-1 do
for t:=0 to m-1 do
inc(s,a);
sum:=s;
end;
begin
readln(n);
readln(m);
for i:=1 to n do begin
for j:=1 to n do begin
read(t);
if t='#' then a:=1;end; readln;
end;
for i:=1 to n-m+1 do
for j:=1 to n-m+1 doif sum(i,j)>max then max:=sum(i,j);
writeln(max);
end.o(n^4)秒杀。。。太弱了。。
-
02009-09-07 14:00:28@
dp wa第三组?!
我很愤怒,就写了暴搜 AC!!! -
02009-09-04 00:51:09@
我很无语,四重循环...
-
02009-08-28 18:22:57@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms
o(n^2) -
02009-08-25 19:28:39@
题刚出时被难度吓倒,谁知数据很弱...
-
02009-08-25 16:15:47@
var
m,n,i,j,x,y,s,max:longint;
a:array[1..100,1..100]of char;
begin
readln(m);
readln(n);
for i:=1 to m do
begin
for j:=1 to m do
read(a);
readln;
end;
max:=0;
for i:=1 to m-(n-1) do
for j:=1 to m-(n-1) do
begin
s:=0;
for x:=i to i+n-1 do
for y:=j to j+n-1 do
if a[x,y]='#' then inc(s);
if s>max then max:=s;
end;
writeln(max);
end. -
02009-08-22 16:31:54@
晕死~费劲编个O(m^2)答案错误。
编个O(m^2*k^2) 0ms 郁闷。。。。。。 -
02009-08-22 18:16:37@
谁帮我看看啊 。。。
-
02009-08-21 21:25:42@
var t,n,m,i,j,k,l,max:longint;
a:array[0..100,0..100] of char;
begin
readln(n);
readln(m);
for i:=1 to n do
begin
for j:=1 to n do
read(a);
readln;
end;
for i:=1 to n-m+1 do
for j:=1 to n-m+1 do
begin
t:=0;
for k:=i to i+m-1 do
for l:=j to j+m-1 do
if a[k,l]='#' then t:=t+1;
if t>max then max:=t;
end;
writeln(max);
end. -
02009-08-13 16:00:49@
四重循环都过了,你还在等什么…………
-
02009-08-11 11:21:31@
读完直接出ans
秒杀 -
02009-08-07 17:33:15@
水水水水水水水水水水!!!!!!1
太水了!!!
暴力狂搜都没有超时!!!O((m-n)^2*n^2) -
02009-08-07 16:47:53@
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms枚举正方形顶点就可以全过了。。。。。
程序不必晒了,很久之前就考过,一次全过。。。。。。 -
02009-08-06 13:19:11@
练了练树桩数组的代码==
这数据也太小了吧==
大材小用== -
02009-07-31 20:06:11@
庆祝第20题AC!
program hedanweiji;
var i,j,k,l,m,n,oooo,ToT:longint;
a:array[-1..1000,-1..1000]of char;
begin
assign(input,'hd.txt');
reset(input);
oooo:=0;readln(m);
readln(n);
for i:=1 to m do begin
for j:=1 to m do
read(a); readln;end;
close(input);
for i:=1 to (m-n+1) do
for j:=1 to (m-n+1) do
begin
tot:=0;
for k:=1 to n do
for l:=1 to n do
if a='#' then inc(ToT);
if ToT>oooo then oooo:=ToT;
end;
writeln(oooo);end.
-
02009-07-30 14:54:58@
数据这么小,就不要出题了
---|---|---|---|---|---|---|---|
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02009-07-21 10:52:52@
递推,34
暴力,34
看题解,if (max==34) cout -
02009-07-17 15:58:05@
program dsa;
var i,j,i1,j1,m,n,s,max:integer;
a:array[1..100,1..100] of 0..1;
st:string;
begin
readln(m);
readln(n);
max:=0;
for i:=1 to m do
begin
readln(st);
for j:=1 to m do if st[j]='.' then a:=0
else if st[j]='#' then a:=1;
end;
for i:=1 to m-(n-1) do
for j:=1 to m-(n-1) do
begin
s:=0;
for i1:=i to i+n-1 do
for j1:=j to j+n-1 do s:=s+a[i1,j1];
if s>max then max:=s;
end;
write(max);
end.农夫山泉
此题建议练习打字
-
02009-07-14 21:33:53@
第三组数据:
8
8
##########
..........
##########
..........
##########
..........
##########
.......... -
02009-07-05 17:35:13@
1次AC
var
s:string;
n,m,i,j,k,x,y,sum,max:integer;
a,h:array[0..100,0..100]of integer;
begin
readln(n,m);
fillchar(a,sizeof(a),0);
fillchar(h,sizeof(h),0);
for i:=1 to n do
begin
readln(s);
for j:=1 to n do
if s[j]='#' then a:=1;
end;
for i:=1 to n do
for j:=1 to n do
h:=h+a;
max:=0;
for i:=1 to n-m+1 do
for j:=1 to n-m+1 do
begin
sum:=0;
x:=i+m-1;
y:=j+m-1;
for k:=i to x do
sum:=sum+h[k,y]-h[k,j-1];
if sum>max then max:=sum;
end;
writeln(max);
end.