用pascal编程 读入N,将N分解 例如: 将4分成 1:4=1+1+1+1; 2:4=1+1+2; 3:4=1+3; 3:4=4; 要源程序……

[复制链接]
查看11 | 回复1 | 2012-11-9 09:25:19 | 显示全部楼层 |阅读模式
用搜索吧program p1;var n,sum,j:longint; ans,t:string;procedure search(x,y:longint;s:string);var i:longint; t:string;begin if x=0 then
begin
inc(sum);
writeln(sum,s);
exit;
end; for i:=y to x do
begin
str(i,t);
search(x-i,i,s+'+'+...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行