C. Dividing the numbers Petya has n integers: 1, 2, 3, ..., n. He wants to split these integers in two non-empty groups in such a way that the absolute difference of sums of integers in each group is as small as possible. Help Petya to split the inte…
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper d…
pid=4671">http://acm.hdu.edu.cn/showproblem.php? pid=4671 Problem Description Makomuno has N servers and M databases. All databases are synchronized among all servers and each database has a ordered list denotes the priority of servers to access.…
Problem - D - Codeforces 题意:问能否在进行K次操作的情况下,将两个数变得相同,操作为每次选择一因子,然后除该因子. 题解:要判断该数最多能进行几次除的操作,其实就是判断这个数有多少个质因子,然后判断最后最多进行的操作数和要求的操作数大小关系,其中K=1的时候要特判一下. 其中开始的时候一直TLE,后来发现是long long 的问题,在没必要的情况下, long long的运行速度是慢与int的,这会在数据多的时候TLE. 详情可见 performance - C++…