# Nemlit 的博客

By a konjac

### 题解 P5110 【块速递推】

posted on 2019-10-22 22:05:07 | under 题解 |

$α+β=0$

$94153035*α+905847205*β=1$

## $Code:$

#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
re int x = 0, f = 1; re char c = getchar();
while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
return x * f;
}
#define rep(i, s, t) for(re int i = s; i <= t; ++ i)
#define maxn 300
const int mod = 1000000007;
const int x1 = 94153035, x2 = 905847205, a = 233230706;
int n, m, ans;
int f1[65540], f2[65540], f3[65540], f4[65540];
int g1[65540], g2[65540], g3[65540], g4[65540];
unsigned long long SA,SB,SC;
void init(){scanf("%llu%llu%llu",&SA,&SB,&SC);}
unsigned long long Rand() {
SA^=SA<<32,SA^=SA>>13,SA^=SA<<1;
unsigned long long t=SA;
SA=SB,SB=SC,SC^=t^SA;return SC;
}
il int mul(int a, int b) {
return 1ll * a * b % mod;
}
il int qpow1(int x) {
return mul(f1[x & 65535], f2[x >> 16]);
}
il int qpow2(int x) {
return mul(g1[x & 65535], g2[x >> 16]);
}
int main() {
f1[0] = g1[0] = 1;
rep(i, 1, 65536) f1[i] = mul(f1[i - 1], x1), g1[i] = mul(g1[i - 1], x2);
f2[0] = g2[0] = 1, f2[1] = f1[65536], g2[1] = g1[65536];
rep(i, 2, 65536) f2[i] = mul(f2[i - 1], f2[1]), g2[i] = mul(g2[i - 1], g2[1]);