早教吧作业答案频道 -->英语-->
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...的网友还看了以下:
若1/(1+a)+2/(1+a^2)+4/(1+a^4)+8/(1+a^8)=0求(1+a)(1+a 2020-03-30 …
一、定义A与B的差集A-B={x|x∈A且x不属于B}.(1)设全集为U,请用集合的交、并、补运算 2020-04-06 …
设A=(α1,α2,α3,α4)为四阶方阵,A*为其伴随矩阵,若(1,0,1,0)的转置为AX=设 2020-04-13 …
a-1/(a+1)2-4,1-a/2-4a+2a注:(a+1)2是(a+1)的平方,不会打上去的. 2020-05-13 …
先化简{a^2-4/(a^2-4a+4)-2/a-2}÷a^2+2a/a-2,再从0,正负1,正负 2020-05-16 …
在△ABC中,已知sin[B+(C/2)]=4/5,求cos(A-B)的值.过程中有一步不懂,co 2020-06-03 …
函数直线的平行送上100分两条直线l1:y-2/x-1=a+2l2:(a^2-4)x+(a-2)y 2020-06-06 …
几何法求轨迹已知定点A(0,2)及圆X^2+Y^2=4,过A作MA切圆于A,M为切线上一个动点,M 2020-06-08 …
(y+2)(y+4)+1“化简求值:(2a+1)(2a-1)+(a-2)²-4(a+1)(a-2) 2020-06-12 …
求解关于隶属度(截集)的问题,关于模糊数学的A=(0,1,2),B=(2,3,4),求A+B,A- 2020-06-28 …