#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typedef _int64 LLN;const double pi = 2.0 * acos(0.0);const double eps = 1.0e-9;const int dr[] = {-1, 0, 1, 0}, dc[] = {0, 1, 0, -1};const int dr6[] = {1, 1, 0, -1, -1, 0}, dc6[] = {0, 1, 1, 0, -1, -1};const int dr8[] = {-1, -1, 0, 1, 1, 1, 0, -1}, dc8[] = {0, 1, 1, 1, 0, -1, -1, -1};const int M = 98765431;LLN pwr(LLN x, LLN p){LLN t = 1 % M;while (p > 0){if (p & 0x01) t = (t * x) % M;x = (x * x) % M;p >>= 1;}return t;}void calc(int* v, int n, int t, LLN s, LLN* sol){LLN d = pwr(n, M - 2);LLN x = pwr(n - 1, t) % M;if (t & 0x01) x = (x + 1) * d % M; else x = (-x + 1) * d % M;x = s * x % M;for (int i = 0; i < n; ++i) sol[i] = (v[i] - x) % M;if (t & 0x01) for (int i = 0; i < n; ++i) sol[i] = (-sol[i]) % M;for (i = 0; i < n; ++i) if (sol[i] < 0) sol[i] += M;}int main(void){int kase = 1000000000;for (int ks = 1, n, t; ks <= kase && scanf("%d %d",&n,&t); ++ks){int v[50100];LLN s = 0;for (int i = 0; i < n && scanf("%d",&v[i]); ++i) s += v[i];s %= M;if (n > 1){LLN sol[50100];calc(v, n, t, s, sol);for (int i = 0; i < n; ++i) printf("%I64d\n",sol[i]);for (i = 0; i < 10 && i <= t; ++i){calc(v, n, i, s, sol);printf("%d:",i);for (int j = 0; j < n; ++j) printf("%I64d\n",sol[i]);}}else printf("0\n");}return 0;}
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedef_int64LLN;constdoublepi=2.0*acos(0.0);constdoubleeps=1.0e-9;constintdr[]={-1,0,1,0},dc[]={0,1,0,-1};constintdr6[]={1,1,0,-1,-1,0},dc6[]={0,1,1,0,-1,-1};constintdr8[]={-1,-1,0,1,1,1,0,-1},dc8[]={0,1,1,1,0,-1,-1,-1};constintM=98765431;LLNpwr(LLNx,LLNp){LLNt=1%M;while(p>0){if(p&0x01)t=(t*x)%M;x=(x*x)%M;p>>=1;}returnt;}voidcalc(int*v,intn,intt,LLNs,LLN*sol){LLNd=pwr(n,M-2);LLNx=pwr(n-1,t)%M;if(t&0x01)x=(x+1)*d%M;elsex=(-x+1)*d%M;x=s*x%M;for(inti=0;i<n;++i)sol[i]=(v[i]-x)%M;if(t&0x01)for(inti=0;i<n;++i)sol[i]=(-sol[i])%M;for(i=0;i<n;++i)if(sol[i]<0)sol[i]+=M;}intmain(void){intkase=1000000000;for(intks=1,n,t;ks<=kase&&scanf("%d%d",&n,&t);++ks){intv[50100];LLNs=0;for(inti=0;i<n&&scanf("%d",&v[i]);++i)s+=v[i];s%=M;if(n>1){LLNsol[50100];calc(v,n,t,s,sol);for(inti=0;i<n;++i)printf("%I64d\n",sol[i]);for(i=0;i<10&&i<=t;++i){calc(v,n,i,s,sol);printf("%d:",i);for(intj=0;j<n;++j)printf("%I64d\n",sol[i]);}}elseprintf("0\n");}return0;}