题目链接:Codeforces468CHackit!题目大意:给据题目定义,找到l,r,使得solve(l,r)%a0.解题思路:f(x+1e18)f(x)+1,所以有so 题目链接:Codeforces 468C Hack it! 题目大意:给据题目定义,找到l,r,使得
题目链接:Codeforces 468C Hack it!
题目大意:给据题目定义,找到l,r,使得solve(l,r) % a = 0.
解题思路:f(x + 1e18) = f(x) + 1,所以有solve(x + 1, x+1e18) = solve(x, x+1e18-1) + 1,假定x为0,我们求出solve(0, 1e18) % a = k,那么a - k,即为区间需要移动的步长。solve(1e18) % a = 45181e17 % a
#include #include #include using namespace std;typedef long long ll;ll A, M = 1e17;int main () { scanf("%lld", A -= 5 * (9 * (M * 18 % A) % A) % A; printf("%lld %lld\n", A, A + M * 10 - 1); return 0;}Codeforces 468C Hack it!(数学)