當前位置:編程學習大全網 - 編程語言 - KSSOL編程

KSSOL編程

# include & ltvector & gt

# include & lt列表& gt

# include & lt地圖& gt

# include & ltset & gt

# include & lt德克& gt

# include & lt堆棧& gt

# include & ltbitset & gt

# include & lt算法& gt

# include & lt功能性& gt

# include & ltnumeric & gt

# include & lt實用工具& gt

# include & ltsstream & gt

# include & ltiostream & gt

# include & ltiomanip & gt

# include & ltcstdio & gt

# include & ltcmath & gt

# include & ltcstdlib & gt

# include & ltctime & gt

使用命名空間std

typedef _ int 64 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 };

const int dr8[] = {-1,-1,0,1,1,0,-1},dc8[] = {0,1,1,1,0,-1,-1 };

const int M = 98765431;

LLN壓水堆(LLN x,LLN p)

{

LLN t = 1% M;

while(p & gt;0)

{

如果(p & amp0x 01)t =(t * x)% M;

x =(x * x)% M;

p & gt& gt= 1;

}

return t;

}

void calc(int* v,int n,int t,LLN s,LLN* sol)

{

LLN d =壓水堆(n,M-2);

LLN x = pwr(n - 1,t)% M;

如果(t & amp0x 01)x =(x+1)* d % M;else x =(-x+1)* d % M;

x = s * x % M;

for(int I = 0;我& ltn;++ I)sol[I]=(v[I]-x)% M;

如果(t & amp0x 01)for(int I = 0;我& ltn;++ I)sol[I]=(-sol[I])% M;

for(I = 0;我& ltn;++ I)if(sol[I]& lt;0)sol[I]+= M;

}

int main(void)

{

int kase = 100000000;

for (int ks = 1,n,t;ks & lt= kase & amp& ampCIN & gt;& gtn & gt& gtt;++ks)

{

int v[50100];

LLN s = 0;

for(int I = 0;我& ltn & amp& ampCIN & gt;& gt五[壹];++ I)s+= v[I];

s % = M;

如果(n & gt1)

{

LLN索爾[50100];

calc(v,n,t,s,sol);

for(int I = 0;我& ltn;++i) printf("%I64d\n ",sol[I]);

for(I = 0;我& lt10。& amp我& lt= t;++i)

{

calc(v,n,I,s,sol);

cout & lt& lt我& lt& lt":";

for(int j = 0;j & ltn;++j) printf("%I64d\n ",sol[I]);

}

}

else cout & lt& lt0 & lt& ltendl

}

返回0;

}

  • 上一篇:2022年廣西貴港市接待辦編外人員招聘公告
  • 下一篇:誰能給我壹些數控編程?最好最簡單的是G2 G3。謝謝1272764360 QQ @ com。
  • copyright 2024編程學習大全網