讨论 / 高阶等差数列+高精
Jollwish 2009-02-25 03:29:00
点我顶贴 收藏 删除

#1 ssxyh@2008-09-29 05:19:00
回复 删除
怎么做???
#2 Jollwish@2008-09-29 05:29:00
回复 删除
还没全对

不过思路是这个

var a:array[1..3000,1..3000]of qword;

n,k,i,j,h:longint;

function b(i:integer):boolean;

var u:longint;

begin

b:=true;

for u:=1 to n-i do

if a[i,u]<>a[i,u+1] then

begin

b:=false;

break;

end;

end;

begin

readln(n,k);

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

i:=1;

repeat

inc(i);

for j:=1 to n-i+1 do a[i,j]:=a[i-1,j+1]-a[i-1,j];

until b(i);

h:=i;

for i:=n-h+2 to n-h+1+k do a[h,i]:=a[h,i-1];

for i:=h-1 downto 1 do

for j:=n-i+2 to n-i+1+k do

a[i,j]:=a[i+1,j-1]+a[i,j-1];

writeln(’Yes’);

write(a[1,n+1]);

for i:=n+2 to n+k do write(’ ’,a[1,i]);

end.

#3 Jollwish@2008-09-29 05:30:00
回复 删除
当然很不严谨

不过貌似都是Yes

#4 binarie@2008-09-29 20:25:00
回复 删除
高精用不着...

qword或者unsigned long long 都可以...

#5 Jollwish@2008-09-30 19:10:00
回复 删除
http://www.rqnoj.cn/Status_Show.asp?SID=100002

你看

#6 binarie@2008-09-30 20:04:00
回复 删除
读入的时候,要用字符串,然后转换成qword……

#7 Jollwish@2008-09-30 20:06:00
回复 删除
ansistring?
#8 binarie@2008-09-30 20:19:00
回复 删除
对对
#9 Jollwish@2008-09-30 20:21:00
回复 删除
还是不行

测试结果1: 通过本测试点|有效耗时172:ms

测试结果2: 通过本测试点|有效耗时47:ms

测试结果3: 通过本测试点|有效耗时47:ms

测试结果4: 通过本测试点|有效耗时47:ms

测试结果5: 通过本测试点|有效耗时47:ms

测试结果6: 通过本测试点|有效耗时172:ms

测试结果7: 通过本测试点|有效耗时62:ms

测试结果8: 运行错误|普通保护错误

测试结果9: 通过本测试点|有效耗时47:ms

测试结果10: 通过本测试点|有效耗时47:ms

提交代码: var a:array[1..4000,1..4000]of qword;

n,k,i,j,h:longint;

s,t:ansistring;

o,p:longint;

function b(i:longint):boolean;

var u:longint;

begin

b:=true;

for u:=1 to n-i do

if a[i,u]<>a[i,u+1] then

begin

b:=false;

break;

end;

end;

begin

readln(n,k);

readln(s);

o:=1;

for i:=1 to n-1 do

begin

p:=0;

while s[o+p]<>’ ’ do inc(p);

t:=copy(s,o,p);

val(t,a[1,i],h);

o:=o+p+1;

end;

t:=copy(s,o,length(s)-o+1);

val(t,a[1,n],h);

i:=1;

repeat

inc(i);

for j:=1 to n-i+1 do a[i,j]:=a[i-1,j+1]-a[i-1,j];

until b(i) or (i>n);

if i>n then

begin

writeln(’No’);

exit;

end;

h:=i;

for i:=n-h+2 to n-h+1+k do a[h,i]:=a[h,i-1];

for i:=h-1 downto 1 do

for j:=n-i+2 to n-i+1+k do

a[i,j]:=a[i+1,j-1]+a[i,j-1];

writeln(’Yes’);

write(a[1,n+1]);

for i:=n+2 to n+k do write(’ ’,a[1,i]);

end.

#10 binarie@2008-09-30 20:31:00
回复 删除
额。。我的读入

readln(n,k);

readln(buf);

buf:=buf+’ ’;

buf2:=’’;

s:=0;

for i:=1 to length(buf) do

begin

if(buf[i]=’ ’)then

begin

inc(s);

val(buf2,a[s]);

buf2:=’’;

end

else

buf2:=buf2+buf[i];

end;

a[]是qword

查看更多回复
提交回复