一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit:65536KTotal Submit:229 Accepted:52 [Submit] [Status] [Discuss] Font Size:Aa Aa Aa DescriptionThis problem is so easy:given an positive integer n,you are to find the number of so
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/08 18:09:24
![一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit:65536KTotal Submit:229 Accepted:52 [Submit] [Status] [Discuss] Font Size:Aa Aa Aa DescriptionThis problem is so easy:given an positive integer n,you are to find the number of so](/uploads/image/z/7102180-28-0.jpg?t=%E4%B8%80%E9%81%93%E6%95%B0%E5%AD%A6%E7%9A%84ACM%E9%A2%98.1514%3Ax+%2B+2y+%2B+3z+%3D+nTime+Limit%3A1000MS+Memory+Limit%3A65536KTotal+Submit%3A229+Accepted%3A52+%5BSubmit%5D+%5BStatus%5D+%5BDiscuss%5D+Font+Size%3AAa+Aa+Aa+DescriptionThis+problem+is+so+easy%3Agiven+an+positive+integer+n%2Cyou+are+to+find+the+number+of+so)
一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit:65536KTotal Submit:229 Accepted:52 [Submit] [Status] [Discuss] Font Size:Aa Aa Aa DescriptionThis problem is so easy:given an positive integer n,you are to find the number of so
一道数学的ACM题.
1514:x + 2y + 3z = n
Time Limit:1000MS Memory Limit:65536K
Total Submit:229 Accepted:52
[Submit] [Status] [Discuss]
Font Size:Aa Aa Aa
Description
This problem is so easy:given an positive integer n,you are to find the number of solutions of the equation
x + 2y + 3z = n
where x,y,z are nonnegative integers.
Input
The input contains several lines of a positive integer n ( n < 10^6 ) followed by a zero.
Output
For each positive integer in the input output the number of solutions of the equation.
Sample Input
1
6
0
Sample Output
1
7
代码如下:
#include
#include
void solve(int x)
{
int i;
__int64 ans=0;
for (i=0;i*3
一道数学的ACM题.1514:x + 2y + 3z = nTime Limit:1000MS Memory Limit:65536KTotal Submit:229 Accepted:52 [Submit] [Status] [Discuss] Font Size:Aa Aa Aa DescriptionThis problem is so easy:given an positive integer n,you are to find the number of so
for (i=0;i*3