⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 let me count the ways.txt

📁 以前ACM在哈工程HRBEU做的一些简单题目
💻 TXT
字号:
#include <stdio.h> 
#define N 5 
#define M 100 
main(){ 
   int coin[N]={1,5,10,25,50}; 
   long table[M]={0}; 
   long cent=0,i=0,j=0; 
   table[0]=1;    
    for(i=0;i<N;i++){ 
      for(j=coin[i];j<M;j++) 
         table[j]+=table[j-coin[i]];                
   }       
   while(scanf("%ld",&cent)==1){                        
       if(table[cent] == 1) 
         printf("There is only 1 way to produce %ld cents change.\n",cent); 
       else 
         printf("There are %ld ways to produce %ld cents change.\n",table[cent],cent);      
   }                             
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -