摘要:特殊数Time Limit:1000MSMemory Limit:65535KBSubmissions:83Accepted:29Description特殊数就是这样一个数:这个数用到1到9这几个组成,每个数字刚好只出现一次。这个数的第一位能被1整除(废话),前两位能被2整除,前三位能被3整除......前N位能被N整除,整个数能被9整除。Inputn(1<=n <=9并且保证有特殊数存在),表示有几位Output此特殊数(最小的一个)Sample Input1Sample Output1解析:这也算是一道水题,就用简单的深搜即可得到结果,见如下代码:# include<st
阅读全文
摘要:火柴棍Time Limit:1000MSMemory Limit:65535KBSubmissions:57Accepted:17Description火柴棍可以拼成10进制的数字,如图所示:现在,gogo给你个n个火柴棍,要求你输出最小能拼成的数字和最大能拼成的数字。Input第一行输入一个整数T:T组测试数据(T<100)每行输入一个n (2 ≤ n ≤ 100): 表示你有的火柴棍数。Output最小能拼成的数字和最大能拼成的数字, 用一个空格分开. 没有前导0.Sample Input436715Sample Output7 76 1118 711108 7111111解析:最大
阅读全文
摘要:骨牌铺方格在1×n的一个长方形方格中,用1×1、1×2、1×3的骨牌铺满方格,输入n ,输出铺放方案的总数。 例如n=3时,为1× 3方格,骨牌的铺放方案有四种,如下图:Input输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是1×nOutput对于每个测试实例,请输出铺放方案的总数,每个实例的输出占一行。Sample Input1230Sample Output 1 2 4解析:这道题和拼图http://www.cnblogs.com/jiangjun/archive/2012/08/17/2644895.
阅读全文
摘要:拼图Description给你1x2、2x1和2x2,3种矩形若干,请你计算出把它们放入2xn的矩形中,一共有多少方法?Input输入有多组测试数据没行输入一个整数n , 3<=n<=20.Output输出能填满这个矩形的方法总数Sample Input3 4Sample Output511【解法一】//DFS思想# include<stdio.h># include<string.h>int dir1[2][2]={{0,1},{1,0}};int vis[2][30];int cnt,ms,st,en;int n;int judge(){ int i,j
阅读全文
摘要:SudokuTime Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 to 9. The other cells ar
阅读全文
摘要:Additive equationsDescriptionWe all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set, can you find all its addtive equations? To explain what an additive equation is, let's look at the following examples: 1+2=3 is an additive equation
阅读全文