题目链接: A. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wan…
C. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to…
C. Dreamoon and Sums   Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if  and , where k is some integer nu…
A. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to…
题目链接 这个题取模的时候挺坑的!!! 题意:div(x , b) / mod(x , b) = k( 1 <= k <= a).求x的和 分析: 我们知道mod(x % b)的取值范围为 1  - (b-1).那么我们可以从这一点入口来进行解题.. mod (x, b) = 1 时, x  =  b + 1, 2b + 1, 3b + 1..... a * b + 1. mod (x , b) = 2 时, x =  2b + 2, 4b + 2, 6b + 2, ..... 2a * b…
[链接] 我是链接,点我呀:) [题意] 让你求出所有x的和 其中 (x div b)是(x mod b)的倍数 且x mod b不等于0 且(x div b)除(x mod b)的值(假设为k),k∈[1..a] [题解] 枚举k从1~a 这样k就固定了 n = x / b; m = x % b; n = mk ····① x = bn + m x = (bk+1)m 而m∈[1..b-1] 所以求和一下就是∑x = (bk+1)( b*(b-1)/2) 这里我们m属于1..b-1,显然由①式…
http://codeforces.com/contest/476/problem/C C. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two…
A. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to…
题目链接:http://codeforces.com/problemset/problem/476/C 题目意思:给出两个数:a 和 b,要求算出 (x/b) / (x%b) == k,其中 k 的取值范围是 [1, a],找出满足所有正整数的 x 并求出所有 x 的和. 是不是觉得无从下手呢?我当时也是 = =  .....看了整晚题解,算是看懂了... 首先设 d = x / b,   m = x % b,那么整条式子就变成 d/m = k  —> d = mk(1) (好快你就知道有啥用了…
题目链接 Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if  and , where k is some integer number in range[1, a…