|
|
|
|
背景 Background |
|
|
为了for beginngers,特设此题,^_^
|
|
|
|
|
|
|
|
描述 Description |
|
|
把自然数N分解为若干个自然数之和。
输入n,输出由各自然数之和组成n的所有方案,要求先输出组成数最小的方案,并输出总方案数。
[样例1]:
输入:5
输出:
1 1 1 1 1
1 1 1 2
1 1 3
1 2 2
1 4
2 3
5
sum=7
[样例2]:
输入:6
输出:
1 1 1 1 1 1
1 1 1 1 2
1 1 1 3
1 1 2 2
1 1 4
1 2 3
1 5
2 2 2
2 4
3 3
6
sum=11
|
|
|
|
|
|
|
|
输入格式 Input Format |
|
|
输入整数n,n<20
|
|
|
|
|
|
|
|
输出格式 Output Format |
|
|
输出由各自然数之和组成n的所有方案,每行一个方案,每个数间一个空格。要求先输出组成数最小的方案,并输出总方案数"sum=总方案"。 |
|
|
|
|
|
|
|
时间限制 Time Limitation |
|
|
各个测试点1s
|
|
|
|
|
|
|
|
注释 Hint |
|
|
Free Pascal Code:
-------------------
program Plus;
var a,b:longint;
begin
readln(a,b);
writeln(a+b);
end.
C++ Code:
-------------------
#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
return 0;
}
|
|
|
|
|
|
|
|
|
Flag |
|
题号 |
P1070 |
|
其它 |
通过 |
30人 |
提交 |
176次 |
通过率 |
17% |
难度 |
0 |
|
|
|
|
|
|