首页 > 代码库 > noip1996 砝码称重
noip1996 砝码称重
题目比较简单,这里就不写分析过程了,直接看代码就能看懂
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /* * ===================================================================================== * * 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; } |
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。