标签:des style blog io color for sp 数据 div
1 #include <stdio.h> 2 3 int main(){ 4 int T; 5 int amount; 6 int sum; 7 int one_amount; 8 int two_amount; 9 int five_amount; 10 int a; 11 int b; 12 int c; 13 int result; 14 15 scanf("%d",&T); 16 17 while(T--){ 18 result=0; 19 scanf("%d%d",&amount,&sum); 20 one_amount=sum/1; 21 two_amount=sum/2; 22 five_amount=sum/5; 23 24 for(a=0;a<=one_amount;a++){ 25 for(b=0;b<=two_amount;b++){ 26 for(c=0;c<=five_amount;c++){ 27 if((a+b+c)==amount && (a*1+b*2+c*5)==sum) 28 result++; 29 } 30 } 31 } 32 printf("%d\n",result); 33 } 34 35 return 0; 36 }
标签:des style blog io color for sp 数据 div
原文地址:http://www.cnblogs.com/zqxLonely/p/4055628.html