标签:new pac back pre http tip ref while enter
///@author Sycamore, ZJNU; ///@date 8/4/2017 #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll m = 200907; ll multiply(ll a, ll b) { return ((a % m) * (b % m)) % m; } ll powermod(ll a, ll b) { ll ret = 1; a %= m; while (b) { if (b & 1) ret = ret*a%m; a = (a*a) % m; b >>= 1; } return ret; } int main() { ios::sync_with_stdio(false); ll N, a1, a2, a3, k; cin >> N; while (N--) { cin >> a1 >> a2 >> a3 >> k; if (a1 + a3 == 2 * a2) cout << (a1 + multiply(k - 1, (a2 - a1))) % m << ‘\n‘; else cout << multiply(a1, powermod(a2 / a1, k - 1)) << ‘\n‘; } return 0; }
HDU 2817: A sequence of numbers
标签:new pac back pre http tip ref while enter
原文地址:http://www.cnblogs.com/zjnu/p/7295105.html