package cn.bdqn.demo02;
public class Zuoye34 {
public static void main(String[] args) {
int sum=0;
// 因为每种都要有,所以,起始都为一
for(int i=1;i<=10;i++){
for(int a=1;a<=20;a++){
for(int b=1;b<=100;b++){
if(i*10+a*5+b==100){
sum++;
}
}
}
}
System.out.println("一共有:"+sum+"兑换方法。");
}
}
很簡單,還有一個
将100元兑换为1元、5元、10元的零钱,请问有多少种兑换方法?
這個 起始值都爲一就好了。