1 条题解
-
1
与502. 序列的第 k 个数一模一样
AC CODE
#include<queue> #include<math.h> #include<stdio.h> #include<iostream> #include<vector> #include<iomanip> #include<string.h> #include<algorithm> #include<cmath> #include<cstdio> #include<utility> #include<cstring> #include<stack> #include<fstream> #include<string> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; const long long M = 200907; long long q( long long a , long long b ) { long long ret = 1; while ( b != 0 ) { if ( b % 2 == 1 ) { ret = ( ret * a % M ) % M; } a = a * a % M; b /= 2; } return ret % M; } long long a , b , c; long long k; long long t; int main() { cin >> t; while ( t-- ) { cin >> a >> b >> c >> k; if ( b - a == c - b ) { long long d = ( b - a ) % M; cout << ( ( k - 1 ) % M * d + a % M ) % M << endl; } else { long long d = b / a % M; cout << ( q( d , k -1 ) * a % M ) % M << endl; } } return 0; }
信息
- ID
- 3038
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- 递交数
- 6
- 已通过
- 3
- 上传者