QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90634 | #2074. LCM Sum | hos_lyric | AC ✓ | 4906ms | 488720kb | C++14 | 9.7kb | 2023-03-24 12:41:24 | 2023-03-24 12:41:28 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
static constexpr unsigned M = M_;
unsigned x;
constexpr ModInt() : x(0U) {}
constexpr ModInt(unsigned x_) : x(x_ % M) {}
constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
ModInt pow(long long e) const {
if (e < 0) return inv().pow(-e);
ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
}
ModInt inv() const {
unsigned a = M, b = x; int y = 0, z = 1;
for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
assert(a == 1U); return ModInt(y);
}
ModInt operator+() const { return *this; }
ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
explicit operator bool() const { return x; }
bool operator==(const ModInt &a) const { return (x == a.x); }
bool operator!=(const ModInt &a) const { return (x != a.x); }
friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////
constexpr unsigned MO = 1'000'000'007;
using Mint = ModInt<MO>;
constexpr int LIM_INV = 110;
Mint inv[LIM_INV], fac[LIM_INV], invFac[LIM_INV];
void prepare() {
inv[1] = 1;
for (int i = 2; i < LIM_INV; ++i) {
inv[i] = -((Mint::M / i) * inv[Mint::M % i]);
}
fac[0] = invFac[0] = 1;
for (int i = 1; i < LIM_INV; ++i) {
fac[i] = fac[i - 1] * i;
invFac[i] = invFac[i - 1] * inv[i];
}
}
Mint binom(Int n, Int k) {
if (n < 0) {
if (k >= 0) {
return ((k & 1) ? -1 : +1) * binom(-n + k - 1, k);
} else if (n - k >= 0) {
return (((n - k) & 1) ? -1 : +1) * binom(-k - 1, n - k);
} else {
return 0;
}
} else {
if (0 <= k && k <= n) {
assert(n < LIM_INV);
return fac[n] * invFac[k] * invFac[n - k];
} else {
return 0;
}
}
}
Mint interpolateIota(const vector<Mint> &fs, Mint x) {
const int fsLen = fs.size();
vector<Mint> prodR(fsLen + 1);
prodR[fsLen] = 1;
for (int i = fsLen; --i >= 0; ) prodR[i] = (x - i) * prodR[i + 1];
Mint ans = 0;
Mint prodL = 1;
for (int i = 0; i < fsLen; ++i) {
// (i - 0) ... (i - (i - 1)) (i - (i + 1)) ... (i - (fsLen - 1))
ans += invFac[i] * (((fsLen - 1 - i) & 1) ? -1 : +1) *
invFac[fsLen - 1 - i] * fs[i] * prodL * prodR[i + 1];
prodL *= (x - i);
}
return ans;
}
/*
A B = lcm(1, ..., K)
lcm(x, x+1, ..., x+K) = F(x) G(x) H(x)
F(x): determined by (x mod A)
G(x): determined by (x mod B)
x = A B h + A i - B j (0 <= i < B, 0 <= j < A)
fix j
\sum[h,i] G(A i) (A B h + A i - B j)^(rise K+1)
precalc partial sums:
\sum[i] G(A i) (Z + A i)^(rise K+1)
= \sum[i] G(A i) \sum[0<=k<=K+1] binom(K+1, k) (A i)^(rise K+1-k) Z^(rise k)
0 < x <= N
B j < A (B h + i) <= N + B j
\sum[0<=h<H] (eval at Z = A B h - B j)
poly of H of degree K+2
*/
constexpr int PLen = 10;
constexpr int P[PLen] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
int E[PLen];
int Q[PLen];
Mint g[4'000'010][32];
int main() {
prepare();
Int N;
int K;
for (; ~scanf("%lld%d", &N, &K); ) {
for (int i = 0; i < PLen; ++i) {
E[i] = 0;
Q[i] = 1;
for (; Q[i] * P[i] <= K; Q[i] *= P[i]) ++E[i];
}
// cerr<<"E = ";pv(E,E+PLen);
// cerr<<"Q = ";pv(Q,Q+PLen);
int H = -1;
Int A = 0, B = 0;
for (int h = 0; h < 1 << PLen; ++h) {
Int a = 1, b = 1;
for (int i = 0; i < PLen; ++i) {
((h >> i & 1) ? b : a) *= Q[i];
}
if (a == 1 || 6 * a <= b) {
if (chmax(A, a)) {
H = h;
B = b;
}
}
}
cerr<<"A = "<<A<<", B = "<<B<<endl;
vector<vector<Mint>> fss(PLen);
for (int i = 0; i < PLen; ++i) {
vector<int> es(Q[i], 0);
for (int x = 0; x < Q[i]; ++x) {
for (int xx = x ? x : Q[i]; xx % P[i] == 0; xx /= P[i]) ++es[x];
}
fss[i].resize(Q[i]);
for (int x = 0; x < Q[i]; ++x) {
int sum = 0, mx = 0;
for (int k = 0; k <= K; ++k) {
const int xx = (x + k) % Q[i];
sum += es[xx];
chmax(mx, es[xx]);
}
// cerr<<P[i]<<" "<<x<<": "<<mx-sum<<endl;
fss[i][x] = Mint(P[i]).pow(mx - sum);
}
}
vector<Mint> F(A, 1), G(B, 1);
for (int i = 0; i < PLen; ++i) {
if (H >> i & 1) {
int xx = 0;
for (int x = 0; x < B; ++x) {
G[x] *= fss[i][xx];
if (++xx == Q[i]) xx = 0;
}
} else {
int xx = 0;
for (int x = 0; x < A; ++x) {
F[x] *= fss[i][xx];
if (++xx == Q[i]) xx = 0;
}
}
}
for (int i = 0; i < B; ++i) {
const Mint gai = G[(A * i) % B];
const Mint ai = Mint(A) * i;
Mint prod = 1;
for (int k = K+1; k >= 0; --k) {
g[i + 1][k] = g[i][k] + gai * binom(K+1, k) * prod;
prod *= (ai + (K+1 - k));
}
}
Mint ans = 0;
const Int q0 = (N / A + 1) / B;
vector<Mint> sums[2];
for (int h = 0; h < 2; ++h) {
sums[h].assign(K + 3, 0);
}
for (int j = 0; j < A; ++j) {
vector<Mint> ss(K + 3, 0);
for (int h = 0; h < K + 2; ++h) {
const Mint z = A * B * h - B * j;
Mint w = g[B][K+1];
for (int k = K; k >= 0; --k) {
w *= (z + k);
w += g[B][k];
}
ss[h + 1] = ss[h] + w;
}
/*
// 0 <= B h + i < m
auto solve = [&](Int m) -> Mint {
const Int q = m / B, r = m % B;
Mint ret = 0;
ret += (q < K + 3) ? ss[q] : interpolateIota(ss, q);
{
const Mint z = A * B * q - B * j;
Mint w = g[r][K+1];
for (int k = K; k >= 0; --k) {
w *= (z + k);
w += g[r][k];
}
ret += w;
}
return ret;
};
const Mint fbj = F[(B * (A - j)) % A];
ans += fbj * (solve((N + B * j) / A + 1) - solve((B * j) / A + 1));
*/
const Mint fbj = F[(B * (A - j)) % A];
const int r0 = (B * j) / A + 1;
const Int m = (N + B * j) / A + 1;
const Int q = m / B;
const int r1 = m % B;
for (int k = 0; k < K + 3; ++k) {
sums[q - q0][k] += fbj * ss[k];
}
{
const Mint z = 0 - B * j;
Mint w = g[r0][K+1];
for (int k = K; k >= 0; --k) {
w *= (z + k);
w += g[r0][k];
}
ans -= fbj * w;
}
{
const Mint z = A * B * q - B * j;
Mint w = g[r1][K+1];
for (int k = K; k >= 0; --k) {
w *= (z + k);
w += g[r1][k];
}
ans += fbj * w;
}
}
for (Int q = q0; q <= q0 + 1; ++q) {
ans += interpolateIota(sums[q - q0], q);
}
printf("%u\n", ans.x);
#ifdef LOCAL
if(N<=10000){
Mint brt=0;
for(int x=1;x<=N;++x){
Mint prod=F[x%A]*G[x%B];
for(int k=0;k<=K;++k)prod*=(x+k);
brt+=prod;
}
cerr<<"brt = "<<brt<<endl;
}
#endif
}
return 0;
}
/*
1000000000000000000 30
524223287
*/
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3592kb
input:
10 3
output:
18936
result:
ok single line: '18936'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
10000 6
output:
43482752
result:
ok single line: '43482752'
Test #3:
score: 0
Accepted
time: 3ms
memory: 3916kb
input:
1000000000 15
output:
688102997
result:
ok single line: '688102997'
Test #4:
score: 0
Accepted
time: 4816ms
memory: 488684kb
input:
1000000000000000000 30
output:
524223287
result:
ok single line: '524223287'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
1000000000000000000 1
output:
41650
result:
ok single line: '41650'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
1000000000000000000 2
output:
688702180
result:
ok single line: '688702180'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
1000000000000000000 3
output:
26803356
result:
ok single line: '26803356'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
1000000000000000000 4
output:
318915933
result:
ok single line: '318915933'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
1000000000000000000 5
output:
355484656
result:
ok single line: '355484656'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
1000000000000000000 6
output:
162499027
result:
ok single line: '162499027'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1000000000000000000 7
output:
60587090
result:
ok single line: '60587090'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
1000000000000000000 8
output:
47433228
result:
ok single line: '47433228'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
1000000000000000000 9
output:
52651033
result:
ok single line: '52651033'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
1000000000000000000 10
output:
488431192
result:
ok single line: '488431192'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
1000000000000000000 11
output:
203359516
result:
ok single line: '203359516'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
1000000000000000000 12
output:
676816954
result:
ok single line: '676816954'
Test #17:
score: 0
Accepted
time: 2ms
memory: 4016kb
input:
1000000000000000000 13
output:
792261385
result:
ok single line: '792261385'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3924kb
input:
1000000000000000000 14
output:
266241285
result:
ok single line: '266241285'
Test #19:
score: 0
Accepted
time: 3ms
memory: 3960kb
input:
1000000000000000000 15
output:
779954568
result:
ok single line: '779954568'
Test #20:
score: 0
Accepted
time: 3ms
memory: 3808kb
input:
1000000000000000000 16
output:
661462563
result:
ok single line: '661462563'
Test #21:
score: 0
Accepted
time: 6ms
memory: 4648kb
input:
1000000000000000000 17
output:
157882037
result:
ok single line: '157882037'
Test #22:
score: 0
Accepted
time: 3ms
memory: 4712kb
input:
1000000000000000000 18
output:
707666921
result:
ok single line: '707666921'
Test #23:
score: 0
Accepted
time: 22ms
memory: 8332kb
input:
1000000000000000000 19
output:
75350354
result:
ok single line: '75350354'
Test #24:
score: 0
Accepted
time: 24ms
memory: 8340kb
input:
1000000000000000000 20
output:
190809078
result:
ok single line: '190809078'
Test #25:
score: 0
Accepted
time: 22ms
memory: 8332kb
input:
1000000000000000000 21
output:
485802406
result:
ok single line: '485802406'
Test #26:
score: 0
Accepted
time: 32ms
memory: 8384kb
input:
1000000000000000000 22
output:
518652177
result:
ok single line: '518652177'
Test #27:
score: 0
Accepted
time: 136ms
memory: 26572kb
input:
1000000000000000000 23
output:
172946983
result:
ok single line: '172946983'
Test #28:
score: 0
Accepted
time: 160ms
memory: 26656kb
input:
1000000000000000000 24
output:
342420888
result:
ok single line: '342420888'
Test #29:
score: 0
Accepted
time: 382ms
memory: 57016kb
input:
1000000000000000000 25
output:
497552775
result:
ok single line: '497552775'
Test #30:
score: 0
Accepted
time: 394ms
memory: 56820kb
input:
1000000000000000000 26
output:
920161969
result:
ok single line: '920161969'
Test #31:
score: 0
Accepted
time: 725ms
memory: 94824kb
input:
1000000000000000000 27
output:
131607220
result:
ok single line: '131607220'
Test #32:
score: 0
Accepted
time: 781ms
memory: 94876kb
input:
1000000000000000000 28
output:
551838958
result:
ok single line: '551838958'
Test #33:
score: 0
Accepted
time: 4598ms
memory: 488232kb
input:
1000000000000000000 29
output:
851846988
result:
ok single line: '851846988'
Test #34:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
1000000000000000000 0
output:
1225
result:
ok single line: '1225'
Test #35:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
265714758284843011 0
output:
708589
result:
ok single line: '708589'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
266540997167959139 1
output:
881831692
result:
ok single line: '881831692'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
267367244641009859 2
output:
423211036
result:
ok single line: '423211036'
Test #38:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
268193483524125987 3
output:
127124157
result:
ok single line: '127124157'
Test #39:
score: 0
Accepted
time: 2ms
memory: 3516kb
input:
269019726702209411 4
output:
39777520
result:
ok single line: '39777520'
Test #40:
score: 0
Accepted
time: 2ms
memory: 3608kb
input:
269845965585325539 5
output:
577495858
result:
ok single line: '577495858'
Test #41:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
270672213058376259 6
output:
262428469
result:
ok single line: '262428469'
Test #42:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
271498451941492387 7
output:
878988911
result:
ok single line: '878988911'
Test #43:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
272324690824608515 8
output:
844720221
result:
ok single line: '844720221'
Test #44:
score: 0
Accepted
time: 2ms
memory: 3544kb
input:
273150934002691939 9
output:
20339607
result:
ok single line: '20339607'
Test #45:
score: 0
Accepted
time: 2ms
memory: 3564kb
input:
996517375802030518 10
output:
436000085
result:
ok single line: '436000085'
Test #46:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
997343614685146646 11
output:
172229324
result:
ok single line: '172229324'
Test #47:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
998169857863230070 12
output:
297495611
result:
ok single line: '297495611'
Test #48:
score: 0
Accepted
time: 2ms
memory: 3832kb
input:
998996101041313494 13
output:
516501983
result:
ok single line: '516501983'
Test #49:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
999822344219396918 14
output:
917263884
result:
ok single line: '917263884'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3964kb
input:
648583102513046 15
output:
962851231
result:
ok single line: '962851231'
Test #51:
score: 0
Accepted
time: 3ms
memory: 3880kb
input:
1474821985629174 16
output:
635473880
result:
ok single line: '635473880'
Test #52:
score: 0
Accepted
time: 3ms
memory: 4760kb
input:
2301069458679894 17
output:
686837493
result:
ok single line: '686837493'
Test #53:
score: 0
Accepted
time: 7ms
memory: 4712kb
input:
3127308341796022 18
output:
746101270
result:
ok single line: '746101270'
Test #54:
score: 0
Accepted
time: 26ms
memory: 8332kb
input:
3953551519879446 19
output:
517293260
result:
ok single line: '517293260'
Test #55:
score: 0
Accepted
time: 24ms
memory: 8264kb
input:
738505179452405440 20
output:
96504747
result:
ok single line: '96504747'
Test #56:
score: 0
Accepted
time: 26ms
memory: 8296kb
input:
739331418335521569 21
output:
151678490
result:
ok single line: '151678490'
Test #57:
score: 0
Accepted
time: 27ms
memory: 8236kb
input:
740157665808572289 22
output:
548846725
result:
ok single line: '548846725'
Test #58:
score: 0
Accepted
time: 144ms
memory: 26500kb
input:
740983904691688417 23
output:
260809011
result:
ok single line: '260809011'
Test #59:
score: 0
Accepted
time: 164ms
memory: 26672kb
input:
741810147869771841 24
output:
62064725
result:
ok single line: '62064725'
Test #60:
score: 0
Accepted
time: 383ms
memory: 56956kb
input:
742636386752887969 25
output:
378996555
result:
ok single line: '378996555'
Test #61:
score: 0
Accepted
time: 411ms
memory: 56820kb
input:
743462629930971393 26
output:
749268774
result:
ok single line: '749268774'
Test #62:
score: 0
Accepted
time: 738ms
memory: 94828kb
input:
744288873109054817 27
output:
343279726
result:
ok single line: '343279726'
Test #63:
score: 0
Accepted
time: 784ms
memory: 94868kb
input:
745115111992170945 28
output:
275401202
result:
ok single line: '275401202'
Test #64:
score: 0
Accepted
time: 4621ms
memory: 488328kb
input:
745941355170254369 29
output:
482258407
result:
ok single line: '482258407'
Test #65:
score: 0
Accepted
time: 4782ms
memory: 488632kb
input:
257120946248004555 30
output:
871039750
result:
ok single line: '871039750'
Test #66:
score: 0
Accepted
time: 2ms
memory: 3616kb
input:
96 5
output:
821858903
result:
ok single line: '821858903'
Test #67:
score: 0
Accepted
time: 26ms
memory: 8364kb
input:
52 19
output:
457717981
result:
ok single line: '457717981'
Test #68:
score: 0
Accepted
time: 2ms
memory: 3580kb
input:
96 10
output:
169742074
result:
ok single line: '169742074'
Test #69:
score: 0
Accepted
time: 143ms
memory: 26660kb
input:
37 24
output:
999563342
result:
ok single line: '999563342'
Test #70:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
81 11
output:
38929854
result:
ok single line: '38929854'
Test #71:
score: 0
Accepted
time: 367ms
memory: 56936kb
input:
21 25
output:
664668034
result:
ok single line: '664668034'
Test #72:
score: 0
Accepted
time: 3ms
memory: 3776kb
input:
70 16
output:
725245983
result:
ok single line: '725245983'
Test #73:
score: 0
Accepted
time: 4777ms
memory: 488720kb
input:
22 30
output:
167544969
result:
ok single line: '167544969'
Test #74:
score: 0
Accepted
time: 2ms
memory: 3836kb
input:
63 13
output:
743502454
result:
ok single line: '743502454'
Test #75:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
7 0
output:
28
result:
ok single line: '28'
Test #76:
score: 0
Accepted
time: 4868ms
memory: 488332kb
input:
267367244641009859 30
output:
625470986
result:
ok single line: '625470986'
Test #77:
score: 0
Accepted
time: 4840ms
memory: 488716kb
input:
268193483524125987 30
output:
55213829
result:
ok single line: '55213829'
Test #78:
score: 0
Accepted
time: 4860ms
memory: 488664kb
input:
269019726702209411 30
output:
965929889
result:
ok single line: '965929889'
Test #79:
score: 0
Accepted
time: 4882ms
memory: 488236kb
input:
269845965585325539 30
output:
87993358
result:
ok single line: '87993358'
Test #80:
score: 0
Accepted
time: 4795ms
memory: 488228kb
input:
270672213058376259 30
output:
88337416
result:
ok single line: '88337416'
Test #81:
score: 0
Accepted
time: 4816ms
memory: 488328kb
input:
271498451941492387 30
output:
753017833
result:
ok single line: '753017833'
Test #82:
score: 0
Accepted
time: 4756ms
memory: 488232kb
input:
272324690824608515 30
output:
972883027
result:
ok single line: '972883027'
Test #83:
score: 0
Accepted
time: 4802ms
memory: 488348kb
input:
273150934002691939 30
output:
644302994
result:
ok single line: '644302994'
Test #84:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
1 0
output:
1
result:
ok single line: '1'
Test #85:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
1 1
output:
2
result:
ok single line: '2'
Test #86:
score: 0
Accepted
time: 4906ms
memory: 488236kb
input:
1 30
output:
775941393
result:
ok single line: '775941393'
Test #87:
score: 0
Accepted
time: 4763ms
memory: 488328kb
input:
100 30
output:
329365290
result:
ok single line: '329365290'