讨论 / 栈溢出!!! (wa40)
pkq0 2011-07-13 02:51:00
点我顶贴 收藏 删除
const

aaa:array[1..26]of longint=(1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,

262144,524288,1048576,2097152,4194304,8388608,16777216,33554432);

bbb:array[1..26]of char=('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');

var

a,b,c:longint;

s:array[1..10]of string;

procedure ww(a,l:longint);

var q:longint;

begin

if a=aaa[l] then begin s[b]:=bbb[l]+s[b];exit;end;

if a>aaa[l] then

if a<aaa[l+1] then

begin

q:=a-aaa[l];

if length(s[b])=0 then s[b]:=' '+bbb[l]

else s[b]:=' '+bbb[l]+s[b];

ww(q,l-1);

end

else ww(a,l+1)

else ww(a,l-1);

end;

begin

readln(a);

for b:=1 to a do

begin

readln(c);

if c<=0 then begin s[b]:='None';continue;end;

ww(c,1);

end;

for b:=1 to a do writeln(s[b]);readln;

end.

#1 pkq0@2011-07-13 00:04:00
回复 删除
188毫秒

测试结果1: 运行错误|栈溢出

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

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

测试结果4: 运行错误|栈溢出

测试结果5: 运行错误|栈溢出

测试结果6: 运行错误|栈溢出

测试结果7: 运行错误|栈溢出

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

测试结果9: 运行错误|栈溢出

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

#2 死兔子@2011-07-13 02:51:00
回复 删除
啦啦啦 O(∩_∩)O~~

查看更多回复
提交回复