Home > Back-end >  O great god teach
O great god teach

Time:09-25

Subject description description

With a 10 yuan note 1, 5 horn and 1 yuan coin, requirements for COINS for a total of 20, and each type of coin at least 1 q: how many kinds of method? Is how many pieces of each change law of each coin? With a 10 yuan note 1, 5 horn and 1 yuan coin, requirements for COINS for a total of 20, and each type of coin at least 1 q: how many kinds of method? Is how many pieces of each change law of each coin?

Input enter

No input input

The output output

The first line, output method number n the first line, output method number n

The second line to the output line n + 1 three number representing the number in the corner of the respectively, the number of the pentagon, the number of one yuan, the second line to the output line n + 1 three Numbers represent in the corner of the number, the number of the pentagon, the number of one yuan,

CodePudding user response:

 # include 
using namespace std;

Int main (void)
{
Int n1 [101]={0};//the number of yuan
Int n2 [101]={0};//the pentagon number
Int n3 [101]={0};//the corner number
Int n=0;
For (int I=1; i<=18; I++)
{
For (int j=1; j<=18; J++)
{
If (I * 10 + j * 5 + (20 - I - j)==100 & amp; & 20 - I - j>
=1){
n++;
N1 [n]=I, n2 [n]=j, n3 [n]=20 - I - j;
}
}
}
CoutFor (int I=1; i<=n; I++) printf (" % d % d % d \ n ", n3 [I], n2 [I], n1 [I]);
}

Adopted, thank you

CodePudding user response:

#include
Int main ()
{
Int a [10], b [10], c [10];
Int x, y, z;
int i=0;
For (int x=1; x<100; X++) {
For (int y=1; Y<20; Y++) {
For (int z=1; Z<10; Z++) {
If (x + y + z==20) {
If (x + 5 * y + 10 * z==100) {
A [I]=x;
[I]=y b;
[I] c=z;
i++;
}
}
}
}
}
Printf (" a total of % d kind of plan, specific as follows \ n ", I);
for(int k=0; K1 Angle: printf (" % d % d 5 Angle: 1 yuan: % d % d \ n ", k + 1, a [k], [k], b c [k]);
}
return 0;
}
  • Related