讨论 / 测评机是不是有问题哦
S.C.Q. 2012-07-31 23:32:00
点我顶贴 收藏 删除
program huochaibang;

var

f:array[0..2000] of longint;

ans,n,x,y,z:longint;

procedure init;

begin

assign(input,'huochaibang.in');

assign(output,'huochaibang.out');

reset(input);

rewrite(output);

end;

procedure readdata;

begin

read(n);

end;

procedure terminate;

begin

close(input);

close(output);

halt;

end;

procedure main;

var

i:longint;

begin

f[0]:=6;

f[1]:=2;

f[2]:=5;

f[3]:=5;

f[4]:=4;

f[5]:=5;

f[6]:=6;

f[7]:=3;

f[8]:=7;

f[9]:=6;

for i:= 10 to 2000 do

begin

x:=i;

while x>0 do

begin

f[i]:=f[x mod 10] + f[i];

x:= x div 10;

end;

end;

ans:=0;

n:=n-4;

for x:= 0 to 2000 do

begin

if f[x]>=n then continue;

for y:= 0 to 2000 do

begin

if f[x]+f[y]>=n then continue;

z:=x+y;

if f[x]+f[y]+f[z]= n then inc(ans); //f[z]是等号后的数字所用火柴棒数

end;

end;

writeln(ans);

end;

begin

init;

readdata;

main;

terminate;

end.

测评机6号 N=24输出144,自己输出128

测评机5号 N=23输出92,自己输出88

坑爹

查看更多回复
提交回复