diff --git a/AcWing/1289/1289.cpp b/AcWing/1289/1289.cpp new file mode 100644 index 00000000..bcf59b9e --- /dev/null +++ b/AcWing/1289/1289.cpp @@ -0,0 +1,38 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int mod = 200907; + +int t, a, b, c, k; + +int binpow(int a, int b) { + int res = 1; + a %= mod; + while (b) { + if (b & 1) res = 1ll * res * a % mod; + a = 1ll * a * a % mod; + b >>= 1; + } + return res; +} + +int main() { + std::ios::sync_with_stdio(false); + + cin >> t; + + while (t--) { + cin >> a >> b >> c >> k; + + if (a - b == b - c) { // 等差数列 + cout << (a + 1ll * (b - a) * (k - 1)) % mod << endl; + } else { // 等比数列 + cout << 1ll * a * binpow(b / a, k - 1) % mod << endl; + } + } + + return 0; +} diff --git a/AcWing/1289/data/2.ans b/AcWing/1289/data/2.ans new file mode 100644 index 00000000..e65a9b3a --- /dev/null +++ b/AcWing/1289/data/2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea505800259f783c224d73d5d424c3e33a55c42b6a055d82627ac05fa8170fd1 +size 30 diff --git a/AcWing/1289/data/2.in b/AcWing/1289/data/2.in new file mode 100644 index 00000000..3170bce9 --- /dev/null +++ b/AcWing/1289/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e1b0493ed13cbf55581ad1c6af357be9517719292898dcb9357d378e1bc616d +size 79