讨论 / 大牛看看,全超时,我晕~~
qzssy5618 2010-02-23 07:12:00
点我顶贴 收藏 删除
查看状态 Show Status

状态题目:监考老师

状态编号: [查看该题]

状态: Unaccepted

测评机: Xeost[5]

得分: 50分

提交日期: 2008-7-30 17:17:00

有效耗时: 279毫秒

测试结果1: 测试结果正确

测试结果2: 测试结果正确

测试结果3: 测试结果正确

测试结果4: 测试结果正确

测试结果5: 测试结果正确

测试结果6: 无输出|运行超时

测试结果7: 无输出|运行超时

测试结果8: 无输出|运行超时

测试结果9: 无输出|运行超时

测试结果10: 无输出|运行超时

提交代码:

var

a,b:array[1..10,1..10]of byte;

i,j,n,m,x,c,d,s:integer;

begin

read(n,m);

s:=-1;

for i:=1 to n do

for j:=1 to m do

read(a[i,j]);

for i:=1 to n do

for j:=1 to m do

begin

for x:=1 to n do

if a[x,j]=1

then b[i,j]:=b[i,j]+1;

for x:=1 to m do

if a[i,x]=1

then b[i,j]:=b[i,j]+1;

if b[i,j]>s

then begin s:=b[i,j]; c:=i; d:=j; end;

end;

write(b[c,d]);

end.

#1 vinence@2008-07-30 02:20:00
回复 删除

数组貌似小了吧?

---------------附AC的程序-------------------------

var

a:array[1..100,1..100] of longint;

x,y,i,j,n,m,max:longint;

f:array[1..100,1..100] of longint;

begin

readln(n,m);

for x:=1 to n do

for y:=1 to m do read(a[x,y]);

for x:=1 to n do

for y:=1 to m do

begin

for i:=1 to n do

f[x,y]:=f[x,y]+a[i,y];

for j:=1 to m do

f[x,y]:=f[x,y]+a[x,j];

if f[x,y]>max then max:=f[x,y];

end;

writeln(max);

end.

#2 DarkMaster@2008-07-30 04:40:00
回复 删除
你不一定是超时,是数组开得小了注意下面:

对于50 %的数据,0<n,m<=10,

对于100 %的数据,0<n,m<=100

#3 qzssy5618@2008-07-30 20:15:00
回复 删除
DARKMASTER同志,谢谢谢谢
#4 chinshiketsu@2010-02-23 07:12:00
回复 删除
水啊水,此题太水

var n,m:longint;

a:array[1..500,1..500]of longint;

sh,sl:array[1..500]of longint;

i,j,tot:longint;

procedure cal;

var i,j:longint;

begin

for i:=1 to n do

for j:=1 to m do

begin

sh[i]:=sh[i]+a[i,j];

sl[j]:=sl[j]+a[i,j];

end;

end;

begin

readln(n,m);

for i:=1 to n do

begin

for j:=1 to m do

read(a[i,j]);

readln;

end;

cal;

tot:=0;

for i:=1 to n do

for j:=1 to m do

if sh[i]+sl[j]>tot

then tot:=sh[i]+sl[j];

writeln(tot);

readln;readln;

end.

查看更多回复
提交回复