列几个例子就可以看出来规律了.
#include <iostream>
#include <cstdio>
#include <memory.h>
using namespace std;
#define MOD 1000000007
const int maxn = 10001;
long long seq[maxn];
long long n, t, k;
long long quick_pow(long long a, long long b){
long long ret = 1;
while (b){
if(b&1){
ret = (ret * a) % MOD ;
}
b >>= 1;
a = (a * a) % MOD ;
}
return ret;
}
int main(){
int cas;
scanf("%d", &cas);
while (cas--){
scanf("%I64d %I64d %I64d", &n, &t, &k);
for (int i = 0; i < n; ++i){
scanf("%I64d", &seq[i]);
}
long long res = quick_pow(k, t);
t %= n;
for (int i = 0; i < n; i++){
if(i > 0 )printf(" ");
printf("%I64d",(res * seq[(i - t + n) % n]) % MOD);
}
printf("\n");
}
return 0;
}