一道數(shù)學(xué)的ACM題.
一道數(shù)學(xué)的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
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
英語(yǔ)人氣:547 ℃時(shí)間:2020-06-22 19:16:34
優(yōu)質(zhì)解答
for (i=0;i*3
我來(lái)回答
類(lèi)似推薦
- 1.如圖,已知線段AB上有兩點(diǎn)C、D,且AC=BD,M、N分別是線段AC、AD的中點(diǎn),若AB=acm
- ACM簡(jiǎn)單題目意思解析,麻煩了
- 新手求指教acm的題目;具體如下,有些限制條件,希望能給我一個(gè)完整的好的答案,
- D:ADA Ⅱ型數(shù)
- HW公司的IT工程師是很辛苦的,經(jīng)常要出差,每個(gè)工程師的出差地點(diǎn)是事先定好的一個(gè)序列,假設(shè)某工程師的出差地總共有A、B、C……Z一共26個(gè)城市,公司給他的安排表是一個(gè)序列BBBCDDDAAKKKKK,表示在B城市工作3天,再去C城市工作1天
- 圓形磁體內(nèi)部磁感線的強(qiáng)弱與圖示方向
- 10.“How long have you been here?” “_______ the end of last month.”
- 一個(gè)字的反義詞
- 一籃桃子連籃共重3.8千克,吃掉一半桃后,連籃還重2千克,請(qǐng)問(wèn)桃子和籃各有多重.
- 8篇暑假英語(yǔ)作文
- 人道主義究竟是指什么
- x-(x-21)=七分之四 解方程
猜你喜歡
- 1動(dòng)聽(tīng)的反義詞是什么
- 2hard 比較級(jí)到底是harder 還是more hard
- 3一只表的時(shí)針長(zhǎng)六厘米你,如果走一圈,時(shí)針的尖端走過(guò)的路程是多少厘米,時(shí)針?biāo)鶔哌^(guò)的面積程是多少厘米?ii
- 4【數(shù)學(xué)】高一三角函數(shù)證明題
- 5物理題關(guān)于物體運(yùn)動(dòng)的快慢
- 6土豆浸沒(méi)到底面長(zhǎng)8厘米,寬4厘米的長(zhǎng)方體玻璃缸中,水面上升了1.5厘米,這個(gè)土豆的體積是( )立方厘米
- 7向量 矢量 是幾年級(jí)的課程呀?
- 8by/on/take/with表示方式時(shí)的區(qū)別
- 9仿照下列詞語(yǔ)的結(jié)構(gòu)規(guī)律,再試著寫(xiě)幾個(gè)
- 10驚嘆不已的已是什么意思
- 11一堆煤12噸,用去了總數(shù)的四分之一,還剩下這堆煤的幾分之幾;如果用去了四分之一噸,還剩下幾噸;如果用去了4噸,用去了這頓煤的幾分之幾?
- 12因參與人體新陳代謝而消耗的氣體是_______(填化學(xué)式)謝謝了!