2219: A^X mod P Time Limit: 5 Sec Memory Limit: 128 MB Submit: 417 Solved: 68 [Submit][Status][Web Board] Description It's easy for ACMer to calculate A^X mod P. Now given seven integers n, A, K, a, b, m, P, and a function f(x) which defined as fol…
题形:另类快速幂 题意: f(x) = K, x = 1 f(x) = (a*f(x-1) + b)%m , x > 1 Now, Your task is to calculate ( A^(f(1)) + A^(f(2)) + A^(f(3)) + ...... + A^(f(n)) ) modular P. 1 <= n <= 10^6 0 <= A, K, a, b <= 10^9 1 <= m, P <= 10^9 思路: 快速幂,求一个很快,但求多个,…
有些题怎么都解不出来,这时候可以打表,找规律,求通项公式等,这些方法让人拍手叫绝,真不错…… Description It's Saturday today, what day is it after 11 + 22 + 33 + ... + NN days? Input There are multiple test cases. The first line of input contains an integer T indicating the number of test cases.…
2014多校第一题,当时几百个人交没人过,我也暴力交了几发,果然不行. 比完了去学习了BSGS才懂! 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4887 Endless Punishment Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 52 Accepted Submissi…
2^x mod n = 1 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9231 Accepted Submission(s): 2837 Problem Description Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1. In…