【YBTOJ】序列的第k个数
作者:互联网
思路:
分类讨论
c o d e code code
#include<iostream>
#include<cstdio>
using namespace std;
long long t, a, b, c, n;
long long ksm(long long x, long long k)
{
long long ans=1;
while(k)
{
if(k&1)
ans=ans*x%200907;
x=x*x%200907;
k>>=1;
}
return ans;
}
int main()
{
scanf("%lld", &t);
while(t--)
{
scanf("%lld%lld%lld%lld", &a, &b, &c, &n);
if(c-b==b-a)
printf("%lld\n", (a+(c-b)*(n-1)%200907)%200907);
else
printf("%lld\n", a*ksm(b/a, n-1)%200907);
}
return 0;
}
标签:code,YBTOJ,个数,long,lld%,200907,ans,序列,lld 来源: https://blog.csdn.net/liuziha/article/details/122134504