{"id":979,"date":"2019-11-15T09:49:14","date_gmt":"2019-11-15T01:49:14","guid":{"rendered":"http:\/\/SmokeyDays.top\/wordpress\/?p=979"},"modified":"2019-11-15T09:49:49","modified_gmt":"2019-11-15T01:49:49","slug":"lp5431-%e3%80%90%e6%a8%a1%e6%9d%bf%e3%80%91%e4%b9%98%e6%b3%95%e9%80%86%e5%85%832","status":"publish","type":"post","link":"http:\/\/SmokeyDays.top\/wordpress\/2019\/11\/15\/lp5431-%e3%80%90%e6%a8%a1%e6%9d%bf%e3%80%91%e4%b9%98%e6%b3%95%e9%80%86%e5%85%832\/","title":{"rendered":"lp5431 \u3010\u6a21\u677f\u3011\u4e58\u6cd5\u9006\u51432"},"content":{"rendered":"\n<p><br> \u633a\u5957\u8def\u7684\u3002<br> \u5148\u8ba1\u7b97\u51fa\u6240\u6709\u6570\u7684\u79ef\u7684\u9006\u5143\uff0c\u518d\u8ba1\u7b97\u9664\u4e86\u8fd9\u4e2a\u6570\u4ee5\u5916\u7684\u6570\u7684\u79ef\uff0c\u7136\u540e\u4e58\u4e00\u8d77\uff0c\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u7ebf\u6027\u6c42\u9006\u5143\u3002 <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include&lt;iostream>\n#include&lt;cstdio>\n#include&lt;cstring>\n#include&lt;algorithm>\n#include&lt;queue>\n#include&lt;vector>\nusing namespace std;\n\ntypedef long long ll;\nconst int N=5000005;\ninline int rd(){\n\tint rt=0;char ch=getchar();\n\twhile(!isdigit(ch)){ch=getchar();}\n\twhile(isdigit(ch)){rt=rt*10+ch-'0';ch=getchar();}\n\treturn rt;\n}\nint n,MOD,k;\nint a[N],pr[N],sf[N];\ninline int pw(int A,int X){\n\tint RT=1;\n\twhile(X){\n\t\tif(X&amp;1){\n\t\t\tRT=1ll*RT*A%MOD;\n\t\t}\n\t\tA=1ll*A*A%MOD;X>>=1;\n\t}\n\treturn RT;\n}\n\nvoid init(){\n\tscanf(\"%d%d%d\",&amp;n,&amp;MOD,&amp;k);\n\tint pl=1;\n\tpr[0]=sf[n+1]=1;\n\tfor(int i=1;i&lt;=n;++i){\n\t\ta[i]=rd();\n\t}\n\tfor(int i=1;i&lt;=n;++i){\n\t\tpr[i]=1ll*pr[i-1]*a[i]%MOD;\n\t}\n\tpl=pw(pr[n],MOD-2);\n\tfor(int i=n;i>=1;--i){\n\t\tsf[i]=1ll*sf[i+1]*a[i]%MOD;\n\t}\n\tint nk=1;\n\tint ans=0;\n\tfor(int i=1;i&lt;=n;++i){\n\t\tnk=1ll*nk*k%MOD;\n\t\tans+=1ll*(1ll*pr[i-1]*sf[i+1]%MOD)*(1ll*pl*nk%MOD)%MOD;ans%=MOD;\n\t}\n\tprintf(\"%d\\n\",ans);\n\t\n}\nint main(){\n\tinit();\n\treturn 0;\n}\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u633a\u5957\u8def\u7684\u3002 \u5148\u8ba1\u7b97\u51fa\u6240\u6709\u6570\u7684\u79ef\u7684\u9006\u5143\uff0c\u518d\u8ba1\u7b97\u9664\u4e86\u8fd9\u4e2a\u6570\u4ee5\u5916\u7684\u6570\u7684\u79ef\uff0c\u7136\u540e\u4e58\u4e00\u8d77\uff0c\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u7ebf\u6027\u6c42\u9006\u5143\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,27,6,59],"tags":[],"_links":{"self":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/979"}],"collection":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/comments?post=979"}],"version-history":[{"count":1,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/979\/revisions"}],"predecessor-version":[{"id":980,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/posts\/979\/revisions\/980"}],"wp:attachment":[{"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/media?parent=979"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/categories?post=979"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/SmokeyDays.top\/wordpress\/wp-json\/wp\/v2\/tags?post=979"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}