标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 4810 Accepted Submission(s): 1259
#include<iostream>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
#define LL long long
#define MOD 1000000007
LL tt,n,t,k,a[10010];
LL poww(LL x,LL y)
{
LL ans=1;
while(y>0)
{
if(y&1)
ans=ans*x%MOD;
x=(x*x)%MOD;
y=y>>1;
}
return ans%MOD;
}
int main()
{
scanf("%I64d",&tt);
while(tt--)
{
scanf("%I64d%I64d%I64d",&n,&t,&k);
LL mul;
mul=poww(k,t);
for(int i=0;i<n;i++)
{
scanf("%I64d",&a[i]);
a[i]=a[i]*mul%MOD;
}
t=t%n;
printf("%d",a[(n+0-t)%n]);
for(int i=1;i<n;i++)
printf(" %d",a[(n+i-t)%n]);
printf("\n");
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/a972290869/p/4231241.html