okay, this is the problem (variation of the knapsack coins problem): you've got 4 coin types:
1 cent, 2 cents, 5 cents and a quarter...infinite amount of each. I'm supposed to find the number of ways in which the coins can be arranged to form the sum of some integer n...
well i... had an idea but it proved pretty wrong.
my idea was to check all the possible ways of forming n with two other numbers, and save the solution as number of needed for the first times number of needed for the second, the problem is it is not always the case, as you can get large numbers cause of repetitions, for example 6:
2 + 4
two ways to make 2 ( 2, 1+1 )
three ways to make 4( 2+2, 1+1+1+1, 2+1 )
multiplied... 6 ways? nope...5
1+1+1+1+1+1
2+1+1+1+1
2+2+1+1
2+2+2
5+1... damn...
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
gregorynoob 2 Junior Poster in Training
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
gregorynoob 2 Junior Poster in Training
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
ArkM 1,090 Postaholic
gregorynoob commented: that speed.. awesome +1
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
gregorynoob 2 Junior Poster in Training
ArkM 1,090 Postaholic
VernonDozier 2,218 Posting Expert Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.