From c830ea65ac0b8248e6be14e3b031a4ae68aa0161 Mon Sep 17 00:00:00 2001 From: Ren Baoshuo Date: Sun, 3 Jan 2021 10:20:25 +0800 Subject: [PATCH] =?UTF-8?q?#10193.=20=E3=80=8C=E4=B8=80=E6=9C=AC=E9=80=9A?= =?UTF-8?q?=206.1=20=E4=BE=8B=201=E3=80=8D=E5=BA=8F=E5=88=97=E7=9A=84?= =?UTF-8?q?=E7=AC=AC=20k=20=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1025637 --- LibreOJ/10193/10193.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 LibreOJ/10193/10193.cpp diff --git a/LibreOJ/10193/10193.cpp b/LibreOJ/10193/10193.cpp new file mode 100644 index 00000000..a9888f29 --- /dev/null +++ b/LibreOJ/10193/10193.cpp @@ -0,0 +1,31 @@ +#include + +using namespace std; + +const int mod = 200907; + +long long binpow(long long a, long long b) { + a %= mod; + long long res = 1; + while (b > 0) { + if (b & 1) res = res * a % mod; + a = a * a % mod; + b >>= 1; + } + return res; +} + +int main() { + int t; + cin >> t; + while (t--) { + long long a, b, c, k; + cin >> a >> b >> c >> k; + if (b - a == c - b) { + cout << (a + (b - a) % mod * (k - 1)) % mod << endl; + } else if (b / a == c / b) { + cout << a * binpow(b / a, k - 1) % mod << endl; + } + } + return 0; +}