一道数学的ACM题.
题目
一道数学的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
答案
for (i=0;i*3
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
热门考点
- 物理变化和化学变化的主要区分是什么?如何判断物质是否发生化学变化?举例说明,求答.
- 学校食堂运回一批粮食,其中大米占粮食总质量的3/4,当吃了36kg大米后,剩下的大米占剩下粮食总质量的3/5.运回这批粮食共几kg?
- 回想自己走过的路,我深深地体会到人生的价值在于奉献.这句话错在哪里
- have you gone to school?和you have gone to school
- 被短路的电阻为什么没有电流流过?
- There ( ) a ruler in the pencil--box.括号里应该填什么?
- 函数y=x×x+kx-3的图像顶点为C,并与X轴交于A B两点,AB=4 (1) 求K
- 20g氢气和氧气的混合气体,在常温下点燃后,剩余2g气体,求原混合气体...
- 采用拨号入网的通信方式是______.
- 一个长方形的长是8厘米,宽是4厘米,以长为轴旋转一周,形成的圆柱体的体积是多少立方厘米?