讨论 / 悬赏,这题的数据错了?
小小小学生 2009-05-31 02:51:00
点我顶贴 收藏 删除
http://www.rqnoj.cn/Discuss_Show.asp?DID=3962

这个帖子显示 他错的第1个数据,正确输出是5位。

http://www.rqnoj.cn/Status_Show.asp?SID=182361

我这个。。。。答案是-21的。。。是不是数据错了?

接下来是我超级恶心的程序:124行。。。

program li;

var n:longint;

ans1,ans2:ansistring;

map:array[0..31,0..31] of longint;

s:array[1..2] of ansistring;

procedure init;

var i,j:longint;

begin

readln(n);

for i:=1 to n do

for j:=1 to n do read(map[i,j]);

s[1]:=’0’; s[2]:=’0’;

end;

function jiafa(s1,s2:ansistring):ansistring;

var i,j,k:longint;

a,b,c:array[0..300] of longint;

begin

fillchar(a,sizeof(a),0);

fillchar(b,sizeof(b),0);

fillchar(c,sizeof(c),0);

a[0]:=length(s1);

for i:=1 to a[0] do a[a[0]-i+1]:=ord(s1[i])-48;

b[0]:=length(s2);

for i:=1 to b[0] do b[b[0]-i+1]:=ord(s2[i])-48;

if a[0]>b[0] then c[0]:=a[0] else c[0]:=b[0];

for i:=1 to c[0] do

c[i]:=a[i]+b[i];

for i:=1 to c[0] do begin c[i+1]:=c[i+1]+c[i] div 10; c[i]:=c[i] mod 10; end;

for i:=c[0]+2 downto 1 do if c[i]<>0 then begin c[0]:=i; break; end;

jiafa:=’’;

for i:=1 to c[0] do jiafa:=chr(c[i]+48)+jiafa;

end;

function chengfa(s1,s2:ansistring):ansistring;

var i,j,k:longint;

a,b,c:array[0..300] of longint;

begin

fillchar(a,sizeof(a),0);

fillchar(b,sizeof(b),0);

fillchar(c,sizeof(c),0);

a[0]:=length(s1);

for i:=1 to a[0] do a[a[0]-i+1]:=ord(s1[i])-48;

b[0]:=length(s2);

for i:=1 to b[0] do b[b[0]-i+1]:=ord(s2[i])-48;

c[0]:=a[0]+b[0]+1;

for i:=1 to a[0] do

for j:=1 to b[0] do c[i+j-1]:=c[i+j-1]+a[i]*b[j];

for i:=1 to c[0] do begin c[i+1]:=c[i+1]+c[i] div 10; c[i]:=c[i] mod 10; end;

for i:=c[0]+2 downto 1 do if c[i]<>0 then begin c[0]:=i; break; end;

chengfa:=’’;

for i:=1 to c[0] do chengfa:=chr(c[i]+48)+chengfa;

end;

function jianfa(s1,s2:ansistring):ansistring;

var i,j,k,t:longint; s3:ansistring;

a,b,c:array[0..300] of longint;

begin

t:=1;

if length(s1)<length(s2) then begin s3:=s1; s1:=s2; s2:=s3; t:=-1; end;

if length(s1)=length(s2) then

begin

i:=1;

while s1[i]=s2[i] do inc(i);

if s2[i]>s1[i] then begin s3:=s1; s1:=s2; s2:=s3; t:=-1; end;

end;

a[0]:=length(s1);

for i:=1 to a[0] do a[a[0]-i+1]:=ord(s1[i])-48;

b[0]:=length(s2);

for i:=1 to b[0] do b[b[0]-i+1]:=ord(s2[i])-48;

c[0]:=a[0];

for i:=1 to c[0] do c[i]:=a[i]-b[i];

for i:=1 to c[0] do

if c[i]<0 then

begin dec(c[i+1]); c[i]:=c[i]+10; end;

for i:=c[0]+2 downto 1 do if c[i]<>0 then begin c[0]:=i; break; end;

jianfa:=’’;

for i:=1 to c[0] do jianfa:=chr(c[i]+48)+jianfa;

if t=-1 then jianfa:=’-’+jianfa;

while (jianfa[1]=’0’) and (length(jianfa)>1) do jianfa:=copy(jianfa,1,length(jianfa));

end;

procedure work(x,y,z:longint);

var j,k,t:longint; ss,i:ansistring;

begin

t:=0; i:=’1’;

while t<n do

begin

if x>n then x:=1;

if y>n then y:=1;

if x<1 then x:=n;

inc(t);

ss:=’’;

j:=1;

while j<=map[x,y] do j:=j*10; j:=j div 10; k:=map[x,y];

while j>0 do

begin

ss:=chr(k div j+48)+ss;

k:=k-k div j *j;

j:=j div 10;

end;

i:=chengfa(i,ss);

if z=1 then begin inc(x); inc(y); end else

begin dec(x); inc(y); end;

end;

s[z]:=jiafa(s[z],i);

end;

procedure doit;

var i:longint;

begin

if n=2 then writeln(map[1,1]*map[2,2]-map[1,2]*map[2,1]);

for i:=1 to n do work(i,1,1);

for i:=1 to n do work(i,1,2);

writeln(jianfa(s[1],s[2]));

end;

begin

init;

doit;

end.

#1 小小小学生@2009-05-09 01:29:00
回复 删除
顶起顶起。。。。。
#2 小小小学生@2009-05-09 23:14:00
回复 删除
顶起顶起~
#3 zrp@2009-05-09 23:48:00
回复 删除
应该不会吧,这么多人都AC了
#4 小小小学生@2009-05-10 00:03:00
回复 删除
上次上次上次``

不是说RQ中木马了吗?

有一题我过了

到我同学过的时候就 错了一个数据

#5 zrp@2009-05-10 01:11:00
回复 删除
RQ也不是天天中木马
#6 小小小学生@2009-05-10 02:22:00
回复 删除
中了木马后 数据会被改掉、

有的数据恢复的时候改错了```

#7 小小小学生@2009-05-12 02:15:00
回复 删除
UP~
#8 小小小学生@2009-05-15 03:01:00
回复 删除
继续顶起//
#9 dislike@2009-05-31 00:43:00
回复 删除
第1各点

n=2

#10 小小小学生@2009-05-31 02:51:00
回复 删除
什么什么??

看不懂 大牛说清楚点。。。。

查看更多回复
提交回复