讨论 / 暴力枚举,有问题吗?
Jay-Chan 2010-07-30 16:15:00
点我顶贴 收藏 删除
var a,b:array[1..16]of integer; r,w,g,y:string;

s,i,j,k,m,n:integer;

begin

read(n);

s:=n mod 16;

r:='hong';

w:='bai';

g:='qing';

y:='huang';

if s=1 then writeln(r)else

if s=2 then writeln(w)else

if s=3 then writeln(g)else

if s=4 then writeln(y)else

if s=5 then writeln(w)else

if s=6 then writeln(g)else

if s=7 then writeln(y)else

if s=8 then writeln(r)else

if s=9 then writeln(g)else

if s=10 then writeln(y)else

if s=11 then writeln(r)else

if s=12 then writeln(w)else

if s=13 then writeln(y)else

if s=14 then writeln(r)else

if s=15 then writeln(w)

else if (s=0) then writeln(g);

if (s=1)or(s=2)or(s=3)or(s=4) then write(r,' ',w,' ',g,' ',y) else

if (s=5)or(s=6)or(s=7)or(s=8) then write(w,' ',g,' ',y,' ',r) else

if (s=9)or(s=10)or(s=11)or(s=12) then write(g,' ',y,' ',r,' ',w)

else if (s=13)or(s=14)or(s=15)or(s=0) then write(y,' ',r,' ',w,' ',g);

readln;

readln;

end.

只过了4个点

#1 flyfire2002@2010-07-22 23:09:00
回复 删除
题号多少?
#2 Jay-Chan@2010-07-25 18:45:00
回复 删除
种菊 P122
#3 flyfire2002@2010-07-26 18:57:00
回复 删除
[quote][url=/Redirect.asp?Act=Reply&DID=6390&RID=15657]原帖[/url]由 [i]Jay-Chan[/i] 于 2010-7-26 9:45:00 发表

种菊 P122[/quote]

看题,n<maxlongint,所以n应该是:longint

#4 Jay-Chan@2010-07-30 16:15:00
回复 删除
原来如此
查看更多回复
提交回复