GT and numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 683    Accepted Submission(s): 190 Problem Description You are given two numbers N and M. Every step you can get a new N in the way…
GT and numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1520    Accepted Submission(s): 381 Problem Description You are given two numbers N and M. Every step you can get a new N in the wa…
POJ 2739 Sum of Consecutive Prime Numbers(素数) http://poj.org/problem? id=2739 题意: 给你一个10000以内的自然数X.然后问你这个数x有多少种方式能由连续的素数相加得来? 分析: 首先用素数筛选法把10000以内的素数都找出来按从小到大保存到prime数组中. 然后找到数X在prime中的上界, 假设存在连续的素数之和==X, 那么一定是从一个比X小的素数開始求和(不会超过X的上界),直到和sum的值>=X为止. 所…
Problem Description Give you a lot of positive integers, just to find out how many prime numbers there are. Input There are a lot of cases. In each case, there is an integer N representing the number of integers to find. Each integer won't exceed 32-…
题目链接 : http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=641&pid=1002 思路 : N有若干个质因子, N = a^b * c^d * e^f...... M也有若干个质因子, M = a^(b+k) * c(d+k1) * e^(f+k2)...... N能到达M的条件是它们的质因子必须完全相同 N每次可以乘上它的若干个质因子, 直到这个质因子的幂次等于M这个质因子的幂次 考虑这样一个事实,…
题意: 给你a和b,a每次和它的因子相乘得到一个新的a,求多少次后可以得到b. 输入样例 3 1 1 1 2 2 4 输出样例 0 -1 1 思路: 每次找出a和b/a的最大公约数(即当前a想得到b能乘的最大数),再进行判断. 第一次直接暴力搞,超时了,发现题意理解错了 T_T. 用unsign按着题意做即可. #include <iostream> #include <cstdio> #include <vector> #include <queue> #…
Quite Good Numbers Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:65536KB Total submit users: 77, Accepted users: 57 Problem 12876 : No special judgement Problem description A "perfect" number is an integer that is equal to the sum…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5272 Dylans loves numbers Description Who is Dylans?You can find his ID in UOJ and Codeforces.His another ID is s1451900 in BestCoder. And now today's problems are all about him. Dylans is given a number…
Dylans loves numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5272 Description Dylans是谁?你可以在 UOJ 和 Codeforces上看到他.在BestCoder里,他有另外一个ID:s1451900.今天的题目都和他有关哦.Dylans得到了一个数N.他想知道N的二进制中有几组1.如果两个1之间有若干个(至少一个)0…
第一眼看这道题目的时候觉得可能会很难也看不太懂,但是看了给出的Hint之后思路就十分清晰了 Consider the first sample. Overall, the first sample has 3 queries. The first query l = 2, r = 11 comes. You need to count f(2) + f(3) + f(5) + f(7) + f(11) = 2 + 1 + 4 + 2 + 0 = 9. The second query comes…