HDU 2069 1 5 10 25 50 These kinds of coins altogether 100 (female function)

Source: Internet
Author: User

Test instructions: There are 50 25 10 5 1 coins with a total of up to 100 inputs n output How many representations are there?

Sample Input
11
26

Sample Output
4
13

1# include <iostream>2# include <cstdio>3# include <cstring>4# include <algorithm>5# include <string>6# include <cmath>7# include <queue>8# include <list>9# define LLLong LongTen using namespacestd; One  A intc1[ -][ the],c2[ -][ the]; - intans[ -] ; - intw[6]={0,1,5,Ten, -, -}; the  - voidInit () { -memset (C1,0,sizeof(C1)); -memset (C2,0,sizeof(C2)); +c1[0][0]=1; -      for(intI=1; i<=5; i++) +     { A          for(intj=0; j<= -; j + +) at              for(intk=0; j+k*w[i]<= -; k++) -                  for(intp=0; k+p<= -;p + +) -c2[j+k*w[i]][p+k]+=C1[j][p]; -  -          for(intj=0; j<= -; j + +) -              for(intp=0;p <= -;p + +) in             { -c1[j][p]=C2[j][p]; toc2[j][p]=0; +             } -     } the      for(intI=1; i<= -; i++) *          for(intj=0; j<= -; j + +) $ANS[I]+=C1[I][J];//C1[11][3] says the scheme is made up of 3 coins, 11.Panax Notoginsengans[0]=1; - } the  + intMain () A { the  +     intN; - Init (); $      while(~SCANF ("%d",&N)) $     { -printf"%d\n", Ans[n]); -     } the     return 0; -}
View Code

HDU 2069 1 5 10 25 50 These kinds of coins altogether 100 (female function)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.