Coin Exchange IssuesTime
limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 6019 Accepted Submission (s): 3462
Problem description in a country only 1 points, 2 points, 3 cent coins, the exchange of money n into coins there are many kinds of laws. Please compile the procedure to calculate the total number of different methods.
Input has only one positive integer n,n less than 32768 per line.
Output corresponds to each input and the number of redemption methods.
Sample Input
293412553
Sample Output
71883113137761
Authorsmallbeer (CML)
SOURCE Hangzhou Electric ACM Training Team Training Tournament (VII)
#include <stdio.h> #define MAX 32768 int A[35000],c[35000];int main () {int n,i,j,k;for (i=0;i<=max;i++) {c[i]=1; a[i]=0;} for (i=2;i<=3;i++) {for (j=0;j<=max;j++) {for (k=0;k+j<max;k+=i) a[k+j]+=c[j];} for (j=0;j<max;j++) { c[j]=a[j]; a[j]=0;} } while (scanf ("%d", &n)!=eof) {printf ("%d\n", C[n]);} return 0;}
Coin Exchange issues (Hangzhou 1284) (female function)