HDACM2069
题目类似于百钱买百鸡,博主有个限制没看到一直WA,就是 Your program should be able to handle up to 100 coins.意思是硬币的个数不能超过100个,我并没有注意到这个,英语差就很头疼/(ㄒoㄒ)/~~
import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);while (sc.hasNext()) {int n = sc.nextInt();long count = 0;for (int i = 0; i <= n; i++) {for (int j = 0; i+j*5 <= n; j++) {for (int j2 = 0; i+j*5+j2*10 <= n; j2++) {for (int k = 0; i+j*5+j2*10+k*25 <= n; k++) {for (int k2 = 0; i+j*5+j2*10+k*25+k2*50 <= n; k2++) {if (i+j*5+j2*10+k*25+k2*50==n&&i+j+j2+k+k2<=100) {count++;}}}}}}System.out.println(count);}}
}