题目比较简单,这里就不写分析过程了,直接看代码就能看懂
/* * ===================================================================================== * * Filename: NOIP1996famachengzhong.c * * Description: rt * * Version: 1.0 * Created: 2014-05-19 14:31:23 * Revision: none * Compiler: gcc * * Author: Rainboy (mn), 597872644@qq.com * Company: NONE * * ===================================================================================== */ #include <stdio.h> #include <string.h> unsigned char a[1001]={0}; int a1,a2,a3,a4,a5,a6; int main () { a[0]=1; int i,j,k,l,m,n,count; count =0; scanf("%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5,&a6); for (i = 0; i <= a1; i++) for (j = 0; j <= a2; j++) for (k = 0; k <= a3; k++) for (l = 0; l <= a4; l++) for (m = 0; m <= a5; m++) for (n = 0; n <= a6; n++) if (!a[i+2*j+3*k+l*5+m*10+20*n]) { a[i+2*j+3*k+l*5+m*10+20*n]=1; count++; } printf("Total=%d",count); return 0; }