HDU 4394 Digital Square】的更多相关文章

Digital Square Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1882    Accepted Submission(s): 741 Problem Description Given an integer N,you should come up with the minimum nonnegative integer…
Digital Square Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1827    Accepted Submission(s): 714 Problem Description Given an integer N,you should come up with the minimum nonnegative integer…
Digital Square Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1310 Accepted Submission(s): 501 Problem Description Given an integer N,you should come up with the minimum nonnegative integer M.M me…
Digital Square Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Given an integer N,you should come up with the minimum nonnegative integer M.M meets the follow condition: M2%10x=N (x=0,1,2,3....)…
题目:给出n,求出最小的m,满足m^2  % 10^k = n,其中k=0,1,2 http://acm.hdu.edu.cn/showproblem.php?pid=4394 只要有一个x满足条件便行了 我们可以初步发现,某个数个位确定,那么平方的最后一位肯定是确定的,那么如果后两们确定,那么平方的最后两们也是确定的,这可以通过乘法的规律得到 那我们只需要BFS一下,不断地找满足最后指定位数的数,1位,2位,--直到找到第一个满足条件的. 注意这里可能是100001这种情况 所以记录当前数字大…
Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 79339    Accepted Submission(s): 24800 Problem Description The digital root of a positive integer is found by summing the digits of…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Digital Roots Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 90108    Accepted Submission(s): 28027 Problem Description The digital root of a…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4394 思路很巧妙,要找到m,可以这样思考,n的个位是有m的个位决定的,从0-9搜一遍,满足情况的话就继续搜索m的十位,这里的状态转移可以利用之前的m,因为m是在m的自身上增加的,这时,其实个位是已经满足情况了,而且,n的个位,十位,百位等等是很难单独取出来的,所以就直接取完后面的全部数字. #include <stdio.h> #include <queue> #include <…
Problem地址:http://acm.hdu.edu.cn/showproblem.php?pid=1404 刚开始想采取找规律的方法解题,可以没有发现规律.无奈,只好采用求PN点的方法. 我们假设数字最右边为第一位,且为最低位.那么可以知道当最高位为0时,那么先手的人必定能胜利,这个可以作为一个剪枝条件. 接下来就是两种操作了:1.降低其中任何一位   2.把其中一个0及这位0后面所有的数字删去 我们只需通过这两个操作,寻找目标数字的后续数字状态的PN状态,即可求得目标数字的PN状态.其实…
Digital Roots Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits,…