'commit'
This commit is contained in:
27
TangDou/AcWing/Math/FMXDL_2.cpp
Normal file
27
TangDou/AcWing/Math/FMXDL_2.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
typedef long long LL;
|
||||
const LL mod = 10086;
|
||||
|
||||
LL pow_mod(LL x, LL p) {
|
||||
LL res = 1;
|
||||
while (p) {
|
||||
if (p & 1) res = res * x % mod;
|
||||
p >>= 1;
|
||||
x = x * x % mod;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
LL ans;
|
||||
LL n = 1e12;
|
||||
|
||||
int main() {
|
||||
for (int i = 1; i <= mod; i++) ans = (ans + pow_mod(i, 2019)) % mod; //求到10086 一个循环周期的长度
|
||||
ans = ans * (n / mod) % mod; //乘上倍数
|
||||
n %= mod; //再加上余数
|
||||
for (int i = 1; i <= n; i++) ans = (ans + pow_mod(i, 2019)) % mod;
|
||||
|
||||
printf("%lld\n", ans);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user