早教吧作业答案频道 -->英语-->
ACM题.PeopleinSilverlandusesquarecoins.Notonlytheyhavesquareshapesbutalsotheirvaluesaresquarenumbers.Coinswithvaluesofallsquarenumbersupto289(=17^2),i.e.,1-creditcoins,4-creditcoins,9-creditcoins,...,and289-creditcoin
题目详情
ACM题.
People in Silverland use square coins.Not only they have square shapes but also their values are square numbers.Coins with values of all square numbers up to 289 (=17^2),i.e.,1-credit coins,4-credit coins,9-credit coins,...,and 289-credit coins,are available in Silverland.
There are four combinations of coins to pay ten credits:
ten 1-credit coins,
one 4-credit coin and six 1-credit coins,
two 4-credit coins and two 1-credit coins,and
one 9-credit coin and one 1-credit coin.
Your mission is to count the number of ways to pay a given amount using coins of Silverland.
Input
The input consists of lines each containing an integer meaning an amount to be paid,followed by a line containing a zero.You may assume that all the amounts are positive and less than 300.
Output
For each of the given amount,one line containing a single integer representing the number of combinations of coins should be output.No other characters should appear in the output.
Sample Input
2
10
30
0
Sample Output
1
4
27
麻烦帮我实现以下.我WA好久了.
People in Silverland use square coins.Not only they have square shapes but also their values are square numbers.Coins with values of all square numbers up to 289 (=17^2),i.e.,1-credit coins,4-credit coins,9-credit coins,...,and 289-credit coins,are available in Silverland.
There are four combinations of coins to pay ten credits:
ten 1-credit coins,
one 4-credit coin and six 1-credit coins,
two 4-credit coins and two 1-credit coins,and
one 9-credit coin and one 1-credit coin.
Your mission is to count the number of ways to pay a given amount using coins of Silverland.
Input
The input consists of lines each containing an integer meaning an amount to be paid,followed by a line containing a zero.You may assume that all the amounts are positive and less than 300.
Output
For each of the given amount,one line containing a single integer representing the number of combinations of coins should be output.No other characters should appear in the output.
Sample Input
2
10
30
0
Sample Output
1
4
27
麻烦帮我实现以下.我WA好久了.
▼优质解答
答案和解析
#include
int sum[30000],suml[30000];
int main()
{
int n,i,j,k;
for(i=0;i
int sum[30000],suml[30000];
int main()
{
int n,i,j,k;
for(i=0;i
看了 ACM题.PeopleinS...的网友还看了以下:
有下列命题:①“若a<b<0,则a2>ab>b2”②命题“a、b都是偶数,则a+b是偶数”的逆否命 2020-04-09 …
命题α:“若a属于R,则2-a²与-4a-7中至少有一个为负数,写出α的逆否命题”,并证明α为真命 2020-04-27 …
已知a>0,设命题p:函数y=a^x为减函数,命题q:当x[1/2,2]时,y=x+1/x>1/a 2020-05-17 …
第一题令A={a,b,c,d,e},B={a,b,c,d,e,f,g,h}.求a)A∪Bb)A∩B 2020-06-17 …
真假命题的知识点1.告诉你一个命题是假命题,那么怎么变成真命题.比如:若A,则B.是假命题.变成真 2020-07-13 …
已知命题p:"对任意x属于[1,2],x^2-a>=0",命题q:"存在x0属于R,x0^2+2a 2020-07-29 …
命题的逆否真假远命题设a.b∈R若ac^2>bc^2则a>b判断原命题逆命题否命题逆否命题的真假我 2020-08-01 …
可逆矩阵的问题若A可逆,则A^*=|A|A^-1;逆命题怎么写?逆命题真还是假?问你个问题,关于逆命 2020-11-03 …
在一次测试中,有AB两个题目,答题规则为,答对A题得a分,答对B题得b分选答哪个题目自由,在一次测试 2020-12-02 …
(本题有a、b两小题,考生任选一题解答,不得两题都解.若两题都解,则以a小题计分)我解答小题(请在横 2020-12-26 …