数学题

学术版

Limitless_lmw @ 2024-08-10 11:31:38

\sum\limits_{i=1}^{n}(a^i+b^i+c^i)^k~\bmod 998244353 n\le1e9,k\le1000,a,b,c\le998244353

by AfterFullStop @ 2024-08-10 11:37:57

看着像扰动法


by Limitless_lmw @ 2024-08-10 11:42:45

@AfterFullStop

S 模拟赛

前面有位大神说拆成

\sum\limits_{i=1}^{n}\sum\limits_{p=0}^{k}\sum\limits_{q=0}^{k-p}\dfrac{k!}{p!q!(k-p-q)!}(a^pb^qc^{k-p-q})^i

然后等比数列求和但是我没听懂?


by AfterFullStop @ 2024-08-10 12:36:56

@Limitless_lmw

把式子的 \sum\limits^{n}_{i=1} 移到后面,确实是等比数列求和(((

这下给糖丸了(


by Limitless_lmw @ 2024-08-10 13:02:30

@AfterFullStop 能帮忙调一下吗,喜提 0 pts

#include "bits/stdc++.h"
using namespace std;

using ll=long long;
const ll mod=998244353;

#define int ll

ll jc[1005]={1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,237554682,331032489,972509923,586493473,986189864,781263551,868586527,401576539,447152495,853155713,655938692,768863313,254940118,638976950,282223649,914551701,567646151,59230529,837902046,858512294,380063818,943237576,71251511,568565690,73799117,807877740,561656917,504900914,736050414,966786798,643813841,376967120,991610752,693098707,631819933,380026194,652885152,700438304,783801149,827885628,953431105,574817667,669396742,551176491,471485044,393535021,258946120,563101905,408908203,396199761,4476118,286471552,652252526,124159537,332734155,664546774,932731521,405323525,827128391,656827325,32665781,420779088,612856657,657865694,743440788,90208990,138799739,123291237,4146667,340026694,271373718,834016546,16057347,382687489,351747894,8239729,733335881,116101992,582837742,714121555,529177317,828694501,862918061,984096910,624186735,277394497,509457672,35305197,571091838,353195002,442288498,78763554,284218346,179814086,273464495,585079223,884241068,436815239,570762585,37770928,275137452,420094585,395148331,916210511,384484016,448118003,419091648,378780110,911397425,385362667,482123450,886890973,56248442,99593221,669406831,833304363,684117056,91469863,3619817,477815844,660113013,609640678,445454584,687162244,306258246,337375122,975901720,865008792,180428606,664753227,226497926,671882048,593194719,757414616,534825369,292850725,710250846,723725482,473913305,161228944,710163960,556615363,426366907,629110194,942353864,153501915,448940013,955053017,33905375,501448985,878391962,309094936,90202437,998183600,988098602,292002538,434455625,985618481,835708947,992996405,90349349,747121431,974484535,809493797,531459590,764837838,146496641,415042202,254312087,365559596,15034417,769844022,670445944,920645812,462738128,147509353,926670186,376329212,5286076,16682239,224939068,713672013,410077468,515635488,757511483,250620684,959542819,245648024,461279527,341739625,494283518,11158019,290905189,31807754,594738960,921648261,961570773,284503024,135476884,770257524,352778720,626319605,893971773,436742839,938226881,891612046,605389239,419133631,790051975,698776675,101079457,680422602,363699441,340036720,323520259,890781283,347065795,963828963,35999734,365983464,423377107,244052091,452313264,932028886,278843969,480737324,98119841,589141721,232456635,352821902,884952181,307551916,481892945,752830816,275761894,508333708,796304814,425577253,7744732,953428111,640423010,951859354,150757491,660632282,80956464,921880652,186688501,623281316,960838290,182055024,962986721,674428682,37861543,88726908,730464317,108543768,249187355,398214199,105657805,788081076,523597853,716869243,484904284,68839082,101783007,344834062,377245410,813057735,869511051,632249897,240981664,558176572,359470893,987751392,981497605,168158341,682031605,136783556,872485029,213318453,611156843,994372655,854337796,328166307,635690938,767716807,949368456,310896195,743029866,788284460,269791013,160431006,17483533,358739333,326096401,613256208,827985555,126723329,479425552,842363627,123306059,784817112,651035089,88751406,183353818,408341650,489220460,824428132,106676827,409630292,542329720,23823152,754813929,501230016,190141340,475209634,617850518,248822928,504352222,738130753,229429911,763019446,60960042,517687052,766019102,369169049,367763486,259041115,487517151,24058691,266176189,724372893,347559835,466380550,118465664,298032599,195964339,706902646,558229202,840785916,318855507,73237589,44990917,44856804,41969380,51372745,474417101,90371997,680471621,762615964,315909151,192830369,505979975,513465545,771916651,563931316,455830180,952115296,854518207,439068750,60569858,691751126,861384823,449523076,766903995,398847740,428396157,76710121,277469864,179586630,901063286,615755686,482027449,389145656,862715922,321919481,446133984,297736338,618563210,901644894,967942380,39954874,808509935,731741300,12189377,858394634,101645887,728580680,673501604,223425145,198341665,270484420,737555623,972521391,511442349,35408615,506702593,113237706,621456928,489699968,600727478,138331995,507849804,635959981,660558532,598024948,13120609,519434015,66207008,986759845,133274881,606865776,370911726,285787502,245452288,237922199,247699365,696825532,858498392,522650381,704391195,243006612,892219155,690498263,277946325,952923637,69092736,453473250,332832650,370111409,247280295,983816503,567317221,467659257,410618102,279948744,916441931,123951161,289843,131009036,450676481,965274362,970563743,354818429,436436867,239214486,990814597,575289652,673776027,830530691,211634028,370242398,464686354,923060716,826038229,265326561,655857337,793687666,483502664,613544924,715886682,925451601,361995155,611665064,276884452,582513460,513772853,44614249,496322356,646975225,38551186,690375670,420341695,644215758,284347304,5519285,702441659,800355478,664508969,512509317,111271972,64914753,188983439,899060915,618048964,329123348,520476760,694848220,729923376,65857201,184108454,952180340,695537907,560168686,504127550,546241032,524755154,95641936,957300352,998047254,897132566,935492191,624700219,910631338,623311483,442422175,20907635,889526670,258015278,919231814,602704929,372167248,730156365,736416438,772653862,677543112,50583521,854912952,755841250,813315094,258895900,492689886,52579818,231940564,769783096,870143506,830748177,392301083,607083067,616630177,418327856,968885533,969597101,330510056,106772739,613288498,287038441,148534776,984868983,602750584,905703403,641020056,391141412,855600471,406905966,452060897,146220114,27226894,300622239,246402661,966977429,333853218,957129806,687030870,231205620,554781917,225695225,871001066,215920892,722694805,830961123,809128221,66858577,577254938,660729677,572410460,8531144,955086108,879412833,717160070,838181256,358120534,867442613,214995541,423594089,510480435,201425962,50239573,742501406,333317032,4618082,746652002,39204105,406026461,822663791,816725342,78746888,330648209,68947362,578293451,323671756,840091789,149156668,546949038,580940870,831792351,451654788,992223605,314300384,688919232,50127897,831198168,85764584,922277388,45867186,395079064,982318484,108404750,436978099,277913562,443876057,464973787,119510152,943273030,471532834,642291264,710486444,392989576,411822912,728548604,980619599,804838200,969392617,616938611,679864478,515487762,974287781,639703568,769802358,82159101,919595587,260656699,418519551,837654636,914110166,384486239,968725214,777446710,7921239,173426063,445607250,938034777,492501840,648281021,668536419,669448382,940724065,968139687,65702834,570768929,85190140,664569192,714508654,698451536,685306014,588503678,400685500,929798396,990247444,615543270,987458568,716335734,376353598,860966586,897920923,859574817,676598591,894639500,320444170,925654986,333679989,637399992,386212259,406856129,1741783,200102351,112799125,966581069,82046522,874509456,100730737,30026768,903716700,92880810,850285978,542466962,849796651,902265665,599555716,627240019,723973684,572853506,571003118,835727049,896611020,915438005,186716095,800172854,921862337,519444023,14933436,680029774,76288499,717370222,258607379,6648464,787268204,828558729,440720515,758507576,364827651,598710132,826796498,309401395,329834740,541046000,116014565,838106798,732280949,970681460,759530844,475290522,951254473,354000675,356721342,722085557,558742121,196007398,496050733,715721982,715436830,220761371,755147503,330222146,109587871,115690562,803216580,471090141,410194929,9081531,848926725,216120377,457055096,141106438,5427795,121291198,221538806,664441256,528153198,160262617,494565705,511833186,240600914,623339172,940344190,453670701,485489872,483813418,675001609,17689882,697102197,505149858,179353574,422408357,787145605,475492301,59847516,761822242,29536614,138012029,253028583,722027178,786786579,500996587,976038887,470491146,868859231,604921979,334240302,183565639,822120542,910147839,838620433,714636864,566299398,700472048,660328672,191674863,800179254,870887082,551279746,8423052,791090742,739240838,615477525,180152406,997865269,691186313,537017810,823923812,28098293,910634736,471755561,628461871,355751165,515346247,809459327,922397748,619331534,984145271,375387750,862000923,400782139,627165971,577438810,958533946,22136246,404685826,883818798,629396128,208689299,352357944,735043458,576053793,5002242,198901384,171454225,274362168,144137745,576414577,770732853,641454129,980299679,790715444,912264558,959215962,805204043,626054745,708347846,572775580,436081123,68135373,357571441,618381478,883419556,306515121,758224100,219163491,31583034,271977777,129398596,995263761,416520979,340956381,128853839,41764716,356741496,909352090,437898461,518115146,109830549,160441938,632486330,32409165,471995821,140924343,90197725,512694113,477065997,511336741,303894747,115225391,153547029,281435686,72365232,372687424,900239093,620821664,124731062,454984121,15368382,762156919,329549406,794183641,634502288,783773414,850030321,372114502,863308047,73263054,272410464,690948618,407534312,873920415,39800123,201714976,680196585,67393490,502563857,144079557,774625298,252276095,238181382,556876958,553306103,826871230,230707737,623315204,82799909,474945270,145213243,412293230,41894904,861395690,916566583,69600268,771010380,300207946,983423239,162142694,544236199,210234189,913073527,139655104,86822205,581435697,926702745,631504484,290329409,969594909,934416192,639121549,32030240,353276450,140939895,844521511,858942833,430054949,700316122,871964693,443050733,413037963,144735230,609159166,988864063,996125710,962954422,61974242,660829735,834796562,322385041,325185741,355513223,29715986,784516578,746339224,473796484,390187100,537064313,942959970,113490403,732773692,709637305,822673051,164866662,522254603,186147601,744176734,320754011,533467607,320372356,799427109,819152201,104388609,212388724,208745182,810648280,951581741,674836099,613693698,468786784,792194798,619029493,636609227,814235164,35790330,815987315,421678599};
ll n,k,a,b,c; 

ll qpow(ll a,ll b){
    ll ans=1%mod;
    while(b){
        ans=b&1?ans*a%mod:ans;
        a=(ll)a * a % mod;
        b >>= 1;
    }
    return ans%mod;
}

signed main(){
    freopen("cal.in","r",stdin);
    freopen("cal.out","w",stdout);
    ll ans=0;
    cin>>n>>k>>a>>b>>c;
    for(int p = 0; p<=k; p++){
        for(int q = 0; q<=k-p; q++){
            ll s=qpow(a,p)*qpow(b,q)%mod*qpow(c,k-p-q)%mod;
            if(s==1){
                s=n;
            }else{
                s=s*((qpow(s,n)-1)/(s-1))%mod;
            }
            ans=ans+((jc[k])/(jc[p]*jc[q]%mod*jc[k-p-q]%mod))*s;
        }
    }
    cout<<ans;
    return 0;
}

by AfterFullStop @ 2024-08-10 13:04:12

@Limitless_lmw

啊你怎么可以直接除(

不应该乘逆元吗(


by AfterFullStop @ 2024-08-10 13:06:49

你被夺舍了?


|