http://acm.hdu.edu.cn/showproblem.php?pid=2817
题意:求等差数列和等比数列的某项
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef __int64 LL;
const int NN=200907;
int main()
{
LL x,y,z,k,t,r,T;
while(scanf("%I64d",&T)!=EOF)
{
while(T--){
scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&k);
k--;
if(y-x==z-y){
t=(y-x)%NN;
printf("%I64d\n",(x%NN+(k*t)%NN)%NN);
}
else
{
t=y/x%NN;
r=1;
while(k){
if(k&1)
r=r*t%NN;
t=t*t%NN;
k=k>>1;
}
printf("%I64d\n",x%NN*r%NN);
}
}
}
return 0;
}