hdu 5641 King's Phone(暴力模拟题)】的更多相关文章

题意: 给定一串密码, 判断是否合法. 长度不小于4 不能重复经过任何点 不能跳过中间点,除非中间点已经经过一次. 分析: 3*3直接记录出可能出现在两点之间的点,直接模拟就好. 注意审题,别漏了判断. 代码: #include <cstdio> #include<algorithm> #include<cstring> #include<map> const int maxm = 15, mod = 1e9+7; int m[maxm][maxm]; in…
Problem Description In a military parade, the King sees lots of new things, including an Andriod Phone. He becomes interested in the pattern lock screen. The pattern × square lattice, the three points ,,, the three points ,,, and the three points ,,.…
King's Phone 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5641 Description In a military parade, the King sees lots of new things, including an Andriod Phone. He becomes interested in the pattern lock screen. The pattern interface is a 3×3 square…
Children's Day Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 648    Accepted Submission(s): 422 Problem Description Today is Children's Day. Some children ask you to output a big letter 'N'. '…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5641 题目类型:水题 题目思路:将点x到点y所需要跨过的点存入mark[x][y]中(无需跨过其它点存0),然后按照题目给的路径逐一判断是否可走,得出结果. 需要判断的: 1.给出的点是否在1-9之间 2.点的数量n是否在4-9之间 3.有没有重复的点 4.两点之间(x-->y)是否需要跨过第三点(z),该点(z)是否已经走过 测试样例(基本考虑了所有情况): 10 4 1 3 6 2 4 6 2…
Problem Description   It is the king's birthday before the military parade . The ministers prepared a rectangle cake of size n×m(1≤n,m≤10000) . The king plans to cut the cake himself. But he has a strange habit of cutting cakes. Each time, he will cu…
题意是现在有n个雕像把一个圆等分了,每一个雕像有一个吸引力. 叫你不移动雕像只去掉雕像让剩下的雕像还能等分这个圆,求剩下的雕像的吸引力之和的最大值. 显然去掉后剩下雕像的间隔应该是n的因子,因为这样才能使剩下的雕像等分圆. 这道题数据量不大,可以暴力枚举,模拟出每一种情况取最大值就可以了. 现在我们分析完这道题了,写一下步骤. 1.求出n的因子存在list中. ;i <= n/; i++) l.push_back(i); } 2.遍历因子(因子是可以去取的间隔),遍历从1到因子作为第一个取的雕像…
http://acm.hdu.edu.cn/showproblem.php?pid=5059 题目大意: 给定一个字符串,如果这个字符串是一个整数,并且这个整数在[a,b]的范围之内(包括a,b),那就输出YES,其它的都是NO. 这个字符串是整数的条件: 1.如果它是正整数,它只包含前导不是0的数(这个数前面没有零). 2.如果它是负整数,只包含一个'-'符号,任然没有前导0. 3.除此之外都不是非法的 解题思路: http://bestcoder.hdu.edu.cn/ 这里有 要注意: 0…
zxa and xor 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5683 Description zxa had a great interest in exclusive disjunction(i.e. XOR) recently, therefore he took out a non-negative integer sequence a1,a2,⋯,an of length n. zxa thought only doing th…
Difference of Clustering HDU - 5486 题意:有n个实体,新旧两种聚类算法,每种算法有很多聚类,在同一算法里,一个实体只属于一个聚类,然后有以下三种模式. 第一种分散,新算法的某几个聚类是旧算法某个聚类的真子集. 第二种聚合,旧算法的某几个聚类是新算法某个聚类的真子集. 第三种1:1,新算法的某个聚类跟旧算法某个聚类相同. 问每种模式存在多少个? 实路上很明了,就是模拟,而且每个实体最多遍历到一次,所以时间上不用担心. 先把聚类的编号hash,把每个实体分配到相应…