标签:mod fine class sso ref sky amp lse long
Code:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
//Mystery_Sky
//
#define Mod 200907
#define M 10001000
#define ll long long
int n, k, a[M];
ll quickPow(ll x, ll k)
{
ll ret = 1;
while(k) {
if(k & 1) ret = (ret * x) % Mod;
k >>= 1;
x = (x * x) % Mod;
}
return ret % Mod;
}
int t;
int main() {
scanf("%d", &t);
while(t--) {
ll a, b, c, k;
scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
if((a + c) == (2 * b)) {
ll d = (b - a) % Mod;
printf("%lld\n", (a + ((k - 1) * d) % Mod) % Mod);
}
else {
ll q = (b / a) % Mod;
printf("%lld\n", (a % Mod * quickPow(q, k-1)) % Mod);
}
}
return 0;
}
标签:mod fine class sso ref sky amp lse long
原文地址:https://www.cnblogs.com/Benjamin-cpp/p/11122817.html