DZY Loves Partition
【思路】
贪心
【代码】
1 #include <iostream> 2 using namespace std; 3 4 typedef long long ll; 5 const int mod=1e9+7; 6 7 ll n,k,a[200000]; 8 9 int main() 10 { 11 int T; 12 cin>>T; 13 while(T--) { 14 cin>>n>>k; 15 ll x=n/k; 16 if(k*(k+1)/2>n) 17 cout<<-1<<endl; 18 else { 19 if(k%2) { 20 for(int i=k/2;i>0;i--) a[i]=x-(k/2-i+1); 21 for(int i=k/2+1;i<=k;i++) a[i]=x+(i-k/2-1); 22 int m=n%k; 23 for(int i=k;m>0;m--,i--) a[i]++; 24 } 25 else { 26 for(int i=k/2;i>0;i--) a[i]=x-(k/2-i+1); 27 for(int i=k/2+1;i<=k;i++) a[i]=x+(i-k/2); 28 int m=n%k; 29 for(int i=k/2;i&&m;i--,m--) a[i]++; 30 if(m>0) 31 for(int i=k;i>k/2&&m;i--,m--) a[i]++; 32 } 33 ll ans=a[1]; 34 for(int i=2;i<=k;i++) { ans*=a[i]; ans%=mod; } 35 cout<<ans<<endl; 36 } 37 } 38 return 0; 39 }
DZY Loves Math
【思路】
打表
打表ans[i,j]表示矩形i*250,j*250的答案,对于一次询问n,m,每次得到最大的ij使得i*250<n j*250<m,然后把剩下的算出来。
一本正经地说如何打表 =_=
【代码】
1 #include<cstdio> 2 #include<cstring> 3 #define FOR(a,b,c) for(int a=b;a<=c;a++) 4 using namespace std; 5 6 typedef long long ll; 7 const int N = 250+5; 8 9 ll gcd(ll a,ll b) 10 { 11 return b==0? a:gcd(b,a%b); 12 } 13 14 int n,m; 15 ll ans[61][61]={ 16 0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,0ll,1233565ll,4074650ll,8499351ll,14528348ll,22112783ll,31258028ll,42022235ll,54333886ll,68215245ll,83604852ll,100342301ll,119037956ll,139247081ll,160953944ll,184189845ll,208808216ll,235131699ll,263014890ll,292077145ll,322860316ll,354671659ll,387832730ll,423732485ll,461079108ll,499977159ll,540274672ll,581612419ll,625238784ll,670079719ll,716110832ll,763486909ll,811607982ll,862174745ll,914838526ll,968366587ll,1023771930ll,1079828725ll,1136843756ll,1196336605ll,1256381288ll,1317713203ll,1379320934ll,1439303311ll,1508074118ll,1578314363ll,1650013408ll,1723239749ll,1797767306ll,1874097743ll,1952029758ll,2031041435ll,2111879366ll,2193671779ll,2276770508ll,2362650307ll,2449778924ll,2538434079ll,2628251382ll,2718503929ll,2811912478ll,0ll,4074650ll,7236964ll,17864932ll,24259110ll,41201906ll,50876714ll,74003070ll,87203958ll,116277486ll,133058054ll,167233594ll,188423532ll,228708828ll,253627440ll,299146386ll,328164752ll,378484650ll,412390688ll,466667998ll,505578840ll,563009154ll,607236872ll,669206596ll,720509506ll,786706462ll,843095434ll,911849082ll,974794670ll,1047549924ll,1115737952ll,1190005868ll,1264697142ll,1339929572ll,1424756182ll,1501767640ll,1593854530ll,1671015968ll,1770440234ll,1847219398ll,1956837368ll,2030004380ll,2149961952ll,2210179474ll,2351928318ll,2422742568ll,2569912062ll,2644572028ll,2796409034ll,2875707214ll,3032824276ll,3116246290ll,3277281100ll,3365867606ll,3528716602ll,3625171034ll,3793290222ll,3894617276ll,4065679406ll,4171705146ll,4345313948ll,0ll,8499351ll,17864932ll,28939297ll,35610296ll,63494369ll,85831754ll,109824679ll,123325676ll,169090859ll,204928360ll,241168757ll,262620164ll,324371425ll,374868562ll,424523261ll,453828086ll,529403663ll,595220668ll,656839453ll,696000496ll,780108199ll,861608968ll,937418147ll,988996720ll,1083420733ll,1184485044ll,1271484839ll,1334685190ll,1436158113ll,1554905956ll,1654406813ll,1729396692ll,1829850397ll,1972075540ll,2084341879ll,2176688896ll,2275329913ll,2436571426ll,2561254695ll,2671159624ll,2756364197ll,2943146462ll,3068576207ll,3211034502ll,3282096321ll,3506136000ll,3659382531ll,3813622236ll,3893219363ll,4130850224ll,4298799179ll,4466017070ll,4554882051ll,4798687738ll,4986725705ll,5166874336ll,5268464759ll,5521869348ll,5723965803ll,5917068192ll,0ll,14528348ll,24259110ll,35610296ll,42740908ll,83198724ll,106324840ll,130613736ll,144392318ll,208411158ll,246107630ll,282609150ll,304327232ll,389027182ll,443487210ll,493446622ll,523107680ll,625330940ll,698187390ll,760051088ll,799452600ll,911465470ll,1005458366ll,1081519300ll,1133368358ll,1257134626ll,1376023992ll,1463256784ll,1526743394ll,1657930338ll,1800923756ll,1900708674ll,1975994418ll,2102503784ll,2279451312ll,2391966442ll,2484589240ll,2605384694ll,2812002824ll,2936912474ll,3047075826ll,3144811750ll,3392914280ll,3519004490ll,3661713362ll,3733029238ll,4035701846ll,4191330348ll,4345870056ll,4425754808ll,4745617662ll,4919142056ll,5086642584ll,5175820758ll,5502192048ll,5702220956ll,5882625548ll,5984482702ll,6321784548ll,6541312016ll,6734673648ll,0ll,22112783ll,41201906ll,63494369ll,83198724ll,124627673ll,148001904ll,172590113ll,186649202ll,270388205ll,330066628ll,389852943ll,436983512ll,525645975ll,580431294ll,630728761ll,660696414ll,790779983ll,898270176ll,995877233ll,1072806210ll,1196162587ll,1290464446ll,1366786217ll,1418950170ll,1572946999ll,1739028432ll,1874442949ll,1988534642ll,2143324915ll,2286618174ll,2386716025ll,2462300926ll,2615399437ll,2852089542ll,3025134285ll,3180239108ll,3344387577ll,3551282570ll,3676456871ll,3786935942ll,3897331653ll,4214759412ll,4408297083ll,4627164056ll,4776128211ll,5081171766ll,5237081669ll,5391918630ll,5472103957ll,5875453374ll,6135451835ll,6391298444ll,6569733045ll,6906700926ll,7107024291ll,7287720602ll,7389877471ll,7812095558ll,8129394837ll,8423805042ll,0ll,31258028ll,50876714ll,85831754ll,106324840ll,148001904ll,171941516ll,196800194ll,211178390ll,316141356ll,378292382ll,461234136ll,512332126ll,601308190ll,656377906ll,706965470ll,737384424ll,896594862ll,1012352332ll,1139932028ll,1227606726ll,1351240580ll,1445812392ll,1522386392ll,1574818868ll,1759960982ll,1945872960ll,2112208804ll,2249776166ll,2404851204ll,2548432030ll,2648801530ll,2724745138ll,2904940488ll,3179214498ll,3377831842ll,3575409640ll,3739783898ll,3946955526ll,4072397760ll,4183135406ll,4306486460ll,4688071714ll,4883043816ll,5180937700ll,5332576040ll,5637899048ll,5794159632ll,5949303390ll,6029824002ll,6518035676ll,6785109782ll,7126618080ll,7314732588ll,7651978856ll,7852565842ll,8033547024ll,8136029326ll,8644330156ll,8981157352ll,9360315550ll,0ll,42022235ll,74003070ll,109824679ll,130613736ll,172590113ll,196800194ll,222291013ll,236944836ll,364744127ll,451601168ll,538106187ll,589488592ll,678812019ll,734166008ll,785060803ll,815781018ll,1005556937ll,1158410560ll,1296089025ll,1384029570ll,1507933157ll,1602804178ll,1679656009ll,1732419960ll,1949945629ll,2185276098ll,2374243455ll,2512092774ll,2667474643ll,2811347392ll,2912144019ll,2988445316ll,3196734687ll,3532716530ll,3772711221ll,3970561580ll,4135185593ll,4342675948ll,4468370537ll,4579377244ll,4715986969ll,5169653104ll,5433945329ll,5735198134ll,5887133191ll,6192757766ll,6349319197ll,6504797150ll,6585623273ll,7160617068ll,7515634583ll,7866863298ll,8055232541ll,8392769716ll,8593647259ll,8774977100ll,8877770909ll,9473948466ll,9909733703ll,10313211738ll,0ll,54333886ll,87203958ll,123325676ll,144392318ll,186649202ll,211178390ll,236944836ll,252319064ll,404399018ll,494578844ll,581379332ll,633129724ll,722765742ll,778554404ll,829797198ll,860847564ll,1082372368ll,1244967160ll,1382897474ll,1471112846ll,1595275260ll,1690422092ll,1767560384ll,1820601842ll,2071360948ll,2328861344ll,2518107528ll,2656262470ll,2811979884ll,2956207500ll,3057332922ll,3133967114ll,3370804152ll,3747590138ll,3987807100ll,4185926028ll,4350829232ll,4558582430ll,4684545894ll,4795833412ll,4945936648ll,5467013902ll,5733881748ll,6035429262ll,6187658028ll,6493583354ll,6650483368ll,6806269640ll,6887384350ll,7550391208ll,7914490896ll,8265975284ll,8454615334ll,8792451474ll,8993657634ll,9175298894ll,9278368110ll,9963404534ll,10421346816ll,10825105844ll,0ll,68215245ll,116277486ll,169090859ll,208411158ll,270388205ll,316141356ll,364744127ll,404399018ll,560287597ll,650737288ll,737842351ll,789871432ll,879861063ll,936006626ll,987568407ll,1018926920ll,1273494763ll,1475366756ll,1653541849ll,1783753948ll,1950691841ll,2089868660ll,2214179651ll,2315751298ll,2588811607ll,2846664396ll,3036310989ll,3174725562ll,3330744761ll,3475302504ll,3576750483ll,3653716548ll,3919737201ll,4359782312ll,4664032081ll,4928185156ll,5159690179ll,5435008446ll,5630957943ll,5812757490ll,6026099421ll,6549765450ll,6816958427ll,7118859576ll,7271362265ll,7577581694ll,7734790141ll,7890864402ll,7972272149ll,8724798616ll,9177805063ll,9620026206ll,9900201845ll,10330784998ll,10627670643ll,10906136110ll,11107487681ll,11814309352ll,12272566077ll,12676644534ll,0ll,83604852ll,133058054ll,204928360ll,246107630ll,330066628ll,378292382ll,451601168ll,494578844ll,650737288ll,741995764ll,829343538ll,881657712ll,971956830ll,1028449774ll,1080338428ll,1112039736ll,1400816444ll,1614221322ll,1827147862ll,1971799166ll,2173062450ll,2330623640ll,2489039050ll,2612788068ll,2886151362ll,3144416040ll,3334364930ll,3473166336ll,3629582308ll,3774449172ll,3876182072ll,3953504702ll,4249170612ll,4733646072ll,5065908352ll,5379187614ll,5636026174ll,5966089750ll,6183709970ll,6427538596ll,6643255350ll,7167268630ll,7434754884ll,7736945032ll,7889732428ll,8196246096ll,8353939148ll,8510331374ll,8592135886ll,9435331808ll,9899912624ll,10433430480ll,10728098286ll,11248945452ll,11564891314ll,11934594544ll,12157579306ll,12864694304ll,13323312738ll,13727689576ll,0ll,100342301ll,167233594ll,241168757ll,282609150ll,389852943ll,461234136ll,538106187ll,581379332ll,737842351ll,829343538ll,917565805ll,970147104ll,1060736093ll,1117541954ll,1169728365ll,1201832200ll,1525635807ll,1779382474ll,2006200599ll,2151101662ll,2387261383ll,2589534664ll,2770601733ll,2894638478ll,3168285733ll,3426842880ll,3617043139ll,3756153028ll,3912871361ll,4058052710ll,4160223841ll,4238004404ll,4563384285ll,5111329234ll,5491634393ll,5805597966ll,6087552753ll,6486301664ll,6762339403ll,7008734216ll,7224743039ll,7749133868ll,8016875013ll,8319364886ll,8472426459ll,8779215092ll,8937229005ll,9093908774ll,9176036825ll,10110327168ll,10662589321ll,11211102680ll,11506032969ll,12117387048ll,12527498937ll,12919372540ll,13142638175ll,13850069986ll,14308992203ll,14713722110ll,0ll,119037956ll,188423532ll,262620164ll,304327232ll,436983512ll,512332126ll,589488592ll,633129724ll,789871432ll,881657712ll,970147104ll,1023686508ll,1114551280ll,1171690926ll,1224290436ll,1256766452ll,1617849076ll,1885999732ll,2113062832ll,2258249080ll,2531551664ll,2755750278ll,2937105116ll,3061434984ll,3335385020ll,3594328858ll,3784904596ll,3924301012ll,4081312626ll,4226842722ll,4329410036ll,4407706924ll,4765010108ll,5362037328ll,5742997472ll,6057213726ll,6365803264ll,6823596440ll,7102992566ll,7349682610ll,7565984004ll,8090653822ll,8358703174ll,8661471222ll,8814782622ll,9121865720ll,9280270516ll,9437256694ll,9519716064ll,10548785916ll,11117349012ll,11666124168ll,11961339366ll,12666932552ll,13101327122ll,13493485072ll,13717048816ll,14424789534ll,14884063980ll,15289085848ll,0ll,139247081ll,228708828ll,324371425ll,389027182ll,525645975ll,601308190ll,678812019ll,722765742ll,879861063ll,971956830ll,1060736093ll,1114551280ll,1206459617ll,1263904724ll,1316824875ll,1349667700ll,1749166293ll,2059844448ll,2330229093ll,2520436096ll,2814070971ll,3038541430ll,3220210083ll,3344838292ll,3619167873ll,3878465408ll,4069353603ll,4209037720ll,4366343479ll,4512177952ll,4615031927ll,4693700950ll,5083472337ll,5746134160ll,6193121923ll,6575120062ll,6939199497ll,7399698956ll,7679384149ll,7926368218ll,8142970533ll,8667963282ll,8936300397ll,9239334596ll,9392922089ll,9700287600ll,9859073431ll,10016389364ll,10099166297ll,11224217564ll,11881876021ll,12521490254ll,12908200509ll,13636461186ll,14071184859ll,14463650990ll,14687499517ll,15395612274ll,15855225353ll,16260573538ll,0ll,160953944ll,253627440ll,374868562ll,443487210ll,580431294ll,656377906ll,734166008ll,778554404ll,936006626ll,1028449774ll,1117541954ll,1171690926ll,1263904724ll,1322428464ll,1375645000ll,1408807912ll,1847890504ll,2174722252ll,2484944228ll,2694737168ll,2988643178ll,3213415862ll,3395356004ll,3520314820ll,3794985404ll,4054573718ll,4245764460ll,4385786998ll,4543461654ll,4689552124ll,4792706920ll,4871691120ll,5294548230ll,6008792844ll,6487750060ll,6926066762ll,7292455608ll,7753259310ll,8033266340ll,8280560992ll,8497496618ll,9022799822ll,9291598398ll,9594931274ll,9748904898ll,10056634622ll,10215897694ll,10373567756ll,10456686996ll,11678921608ll,12354940124ll,13092195602ll,13500539240ll,14229137302ll,14664188404ll,15056981236ll,15281155246ll,15989584674ll,16449549332ll,16855186296ll,0ll,184189845ll,299146386ll,424523261ll,493446622ll,630728761ll,706965470ll,785060803ll,829797198ll,987568407ll,1080338428ll,1169728365ll,1224290436ll,1316824875ll,1375645000ll,1430041549ll,1463542154ll,1943417599ll,2314204180ll,2643217351ll,2853293506ll,3147525289ll,3372574754ll,3554920691ll,3680263924ll,3955260127ll,4215169168ll,4406791353ll,4547290442ll,4705373465ll,4851771930ll,4955237045ll,5034557596ll,5491136365ll,6272604198ll,6805005371ll,7245694666ll,7612376257ll,8073486134ll,8353801485ll,8601430298ll,8818668727ll,9344247678ll,9613408755ll,9917024554ll,10071336047ll,10379424792ll,10539058377ll,10697027522ll,10780496909ll,12101261994ll,12866333997ll,13625430668ll,14034055597ll,14762969286ll,15198349919ll,15591467528ll,15815930535ll,16524722294ll,16984973253ll,17390935324ll,0ll,208808216ll,328164752ll,453828086ll,523107680ll,660696414ll,737384424ll,815781018ll,860847564ll,1018926920ll,1112039736ll,1201832200ll,1256766452ll,1349667700ll,1408807912ll,1463542154ll,1498315892ll,2019885714ll,2409382386ll,2738680328ll,2949055526ll,3243613282ll,3468986968ll,3651711436ll,3777393664ll,4052713128ll,4312953462ll,4505021966ll,4645913084ll,4804400276ll,4951116678ll,5054925378ll,5134563112ll,5625261940ll,6461275536ll,6996079542ll,7437064258ll,7804035470ll,8265458080ll,8546106692ll,8794056546ll,9011578734ll,9537458466ll,9807011062ll,10110927866ll,10265565758ll,10573988000ll,10733960606ll,10892244724ll,10976019702ll,12396088190ll,13183055322ll,13942430946ll,14351356726ll,15080553882ll,15516261476ll,15909670922ll,16134516908ll,16843606662ll,17304331484ll,17710656468ll,0ll,235131699ll,378484650ll,529403663ll,625330940ll,790779983ll,896594862ll,1005556937ll,1082372368ll,1273494763ll,1400816444ll,1525635807ll,1617849076ll,1749166293ll,1847890504ll,1943417599ll,2019885714ll,2561476909ll,2951227638ll,3280818419ll,3491466922ll,3786357575ll,4012052598ll,4195070407ll,4321027832ll,4596740993ll,4857363040ll,5049720951ll,5191040466ll,5349843479ll,5496898076ll,5601026865ll,5680966836ll,6206681433ll,7111061232ll,7712063573ll,8220943016ll,8656180083ll,9186719012ll,9538970481ll,9858958042ll,10149640193ll,10748924206ll,11090612119ll,11474001660ll,11709298385ll,12099530762ll,12342584597ll,12584865666ll,12754245185ll,14198114394ll,14985533939ll,15745175890ll,16154378477ll,16883886462ll,17319865509ll,17713570138ll,17938688777ll,18648197536ll,19109281741ll,19515948668ll,0ll,263014890ll,412390688ll,595220668ll,698187390ll,898270176ll,1012352332ll,1158410560ll,1244967160ll,1475366756ll,1614221322ll,1779382474ll,1885999732ll,2059844448ll,2174722252ll,2314204180ll,2409382386ll,2951227638ll,3342324992ll,3672182028ll,3883089712ll,4178244734ll,4404291500ll,4587573426ll,4713802726ll,4989798414ll,5250839986ll,5443664450ll,5585261892ll,5744349892ll,5891712974ll,5996179638ll,6076417116ll,6637940362ll,7600953990ll,8239175524ll,8811750690ll,9281740070ll,9881403182ll,10265029876ll,10660865004ll,10977975986ll,11660479686ll,12016965662ll,12498512212ll,12753622392ll,13244168498ll,13508836426ll,13852733114ll,14046388418ll,15490758884ll,16278583268ll,17038576448ll,17448444400ll,18178411084ll,18614651272ll,19008609248ll,19234016026ll,19943835526ll,20405269952ll,20812277870ll,0ll,292077145ll,466667998ll,656839453ll,760051088ll,995877233ll,1139932028ll,1296089025ll,1382897474ll,1653541849ll,1827147862ll,2006200599ll,2113062832ll,2330229093ll,2484944228ll,2643217351ll,2738680328ll,3280818419ll,3672182028ll,4003416341ll,4214578816ll,4509989811ll,4736289710ll,4919856099ll,5046418980ll,5322681519ll,5584140350ll,5777246481ll,5919256328ll,6078673923ll,6226354722ll,6331140561ll,6411718542ll,7009276205ll,8041015688ll,8736533753ll,9314674282ll,9814606133ll,10489306360ll,10938511935ll,11344372850ll,11677880207ll,12445807250ll,12872972641ll,13375662052ll,13631030925ll,14222205286ll,14567893453ll,14936595402ll,15130526943ll,16575337150ll,17363522217ll,18123818668ll,18534162421ll,19264405694ll,19700891665ll,20095482276ll,20321424023ll,21031581526ll,21493362575ll,21900677240ll,0ll,322860316ll,505578840ll,696000496ll,799452600ll,1072806210ll,1227606726ll,1384029570ll,1471112846ll,1783753948ll,1971799166ll,2151101662ll,2258249080ll,2520436096ll,2694737168ll,2853293506ll,2949055526ll,3491466922ll,3883089712ll,4214578816ll,4427208484ll,4722865866ll,4949434216ll,5133332748ll,5260180268ll,5536767524ll,5798496600ll,5992026180ll,6134333890ll,6294172676ll,6442149786ll,6547275376ll,6628269484ll,7262798914ll,8357144024ll,9058840994ll,9637268910ll,10167834966ll,10914778690ll,11374941964ll,11781077572ll,12131499400ll,12985260944ll,13431624144ll,13934572822ll,14190221830ll,14884244624ll,15256944562ll,15625928206ll,15820155850ll,17265237152ll,18054137926ll,18814844992ll,19225491362ll,19956034026ll,20392812774ll,20787906992ll,21014246684ll,21724904208ll,22187046792ll,22594755504ll,0ll,354671659ll,563009154ll,780108199ll,911465470ll,1196162587ll,1351240580ll,1507933157ll,1595275260ll,1950691841ll,2173062450ll,2387261383ll,2531551664ll,2814070971ll,2988643178ll,3147525289ll,3243613282ll,3786357575ll,4178244734ll,4509989811ll,4722865866ll,5020018729ll,5246874408ll,5431035555ll,5558203124ll,5835090429ll,6097121518ll,6290915677ll,6433657522ll,6593756653ll,6742072578ll,6847639405ll,6929064524ll,7600605791ll,8763526766ll,9527883917ll,10170396152ll,10762302145ll,11520016854ll,11980450161ll,12386876596ll,12754362127ll,13694923264ll,14208771911ll,14785805772ll,15116544925ll,15839293320ll,16212303027ll,16581588146ll,16776130017ll,18221512704ll,19010878161ll,19771864308ll,20182814277ll,20913639680ll,21350712149ll,21746260058ll,21973067741ll,22684060226ll,23146651547ll,23554671134ll,0ll,387832730ll,607236872ll,861608968ll,1005458366ll,1290464446ll,1445812392ll,1602804178ll,1690422092ll,2089868660ll,2330623640ll,2589534664ll,2755750278ll,3038541430ll,3213415862ll,3372574754ll,3468986968ll,4012052598ll,4404291500ll,4736289710ll,4949434216ll,5246874408ll,5475321004ll,5659748264ll,5787218568ll,6064381130ll,6326720538ll,6520850000ll,6663889362ll,6824331650ll,6972905156ll,7078745444ll,7160655874ll,7869984984ll,9099322496ll,9907904394ll,10621028132ll,11224530918ll,11982533996ll,12443239550ll,12849978530ll,13234816804ll,14262742962ll,14801996370ll,15480968220ll,15843807334ll,16566906172ll,16940270180ll,17309869512ll,17504705614ll,18950358014ll,19739986628ll,20501230206ll,20912474764ll,21643591452ll,22080977620ll,22476828696ll,22703956796ll,23415277468ll,23878178434ll,24286551804ll,0ll,423732485ll,669206596ll,937418147ll,1081519300ll,1366786217ll,1522386392ll,1679656009ll,1767560384ll,2214179651ll,2489039050ll,2770601733ll,2937105116ll,3220210083ll,3395356004ll,3554920691ll,3651711436ll,4195070407ll,4587573426ll,4919856099ll,5133332748ll,5431035555ll,5659748264ll,5845819441ll,5973552326ll,6251000499ll,6513663956ll,6708112091ll,6851479866ll,7012415131ll,7161308750ll,7267456781ll,7349797180ll,8098868995ll,9398727192ll,10268250995ll,10994483708ll,11598250005ll,12356547028ll,12817549095ll,13224611924ll,13627136499ll,14747068478ll,15351429441ll,16066553906ll,16429668553ll,17153107946ll,17526816705ll,17896719206ll,18091843393ll,19537782440ll,20327657141ll,21089551626ll,21501208481ll,22232605398ll,22670336475ll,23066535088ll,23293992793ll,24005668678ll,24468923305ll,24877624390ll,0ll,461079108ll,720509506ll,988996720ll,1133368358ll,1418950170ll,1574818868ll,1732419960ll,1820601842ll,2315751298ll,2612788068ll,2894638478ll,3061434984ll,3344838292ll,3520314820ll,3680263924ll,3777393664ll,4321027832ll,4713802726ll,5046418980ll,5260180268ll,5558203124ll,5787218568ll,5973552326ll,6103008244ll,6380715506ll,6643677670ll,6838452604ll,6982255638ll,7143539582ll,7292929268ll,7399564596ll,7482237958ll,8271559158ll,9643716080ll,10525373504ll,11251876632ll,11855913054ll,12614532844ll,13075841710ll,13483228612ll,13903587106ll,15117405326ll,15752560788ll,16467965544ll,16831378538ll,17555123672ll,17929130664ll,18299337416ll,18494833028ll,19941044452ll,20731215868ll,21493596210ll,21905835770ll,22637621238ll,23075674302ll,23472217422ll,23700054956ll,24412024446ll,24875623328ll,25284779892ll,0ll,499977159ll,786706462ll,1083420733ll,1257134626ll,1572946999ll,1759960982ll,1949945629ll,2071360948ll,2588811607ll,2886151362ll,3168285733ll,3335385020ll,3619167873ll,3794985404ll,3955260127ll,4052713128ll,4596740993ll,4989798414ll,5322681519ll,5536767524ll,5835090429ll,6064381130ll,6251000499ll,6380715506ll,6660180841ll,6923459590ll,7118596603ll,7262749308ll,7424357449ll,7574174240ll,7681226449ll,7764272114ll,8594498937ll,10038444040ll,10980684575ll,11769095614ll,12435337789ll,13256744908ll,13782652749ll,14254970918ll,14743529503ll,15985459044ll,16620924425ll,17336602842ll,17700305925ll,18424385878ll,18798715297ll,19169250360ll,19365057255ll,20811661420ll,21602121573ll,22365083908ll,22777712945ll,23509838430ll,23948197887ll,24345085114ll,24573214365ll,25285498996ll,25749440889ll,26158968548ll,0ll,540274672ll,843095434ll,1184485044ll,1376023992ll,1739028432ll,1945872960ll,2185276098ll,2328861344ll,2846664396ll,3144416040ll,3426842880ll,3594328858ll,3878465408ll,4054573718ll,4215169168ll,4312953462ll,4857363040ll,5250839986ll,5584140350ll,5798496600ll,6097121518ll,6326720538ll,6513663956ll,6643677670ll,6923459590ll,7188572128ll,7383984966ll,7528427382ll,7690307010ll,7840389240ll,7947708838ll,8031185300ll,8902853468ll,10422505738ll,11416600508ll,12285188260ll,13001560382ll,13907598258ll,14481754384ll,15045207250ll,15559894358ll,16802189604ll,17437996032ll,18153930320ll,18518034004ll,19242465858ll,19617131416ll,19987955912ll,20184223130ll,21631180716ll,22422001728ll,23185318414ll,23598329976ll,24330821156ll,24769516118ll,25166748744ll,25395219584ll,26107821396ll,26572033458ll,26981861056ll,0ll,581612419ll,911849082ll,1271484839ll,1463256784ll,1874442949ll,2112208804ll,2374243455ll,2518107528ll,3036310989ll,3334364930ll,3617043139ll,3784904596ll,4069353603ll,4245764460ll,4406791353ll,4505021966ll,5049720951ll,5443664450ll,5777246481ll,5992026180ll,6290915677ll,6520850000ll,6708112091ll,6838452604ll,7118596603ll,7383984966ll,7581291189ll,7726017702ll,7888190763ll,8038561828ll,8146193385ll,8229984178ll,9143291203ll,10734297148ll,11792677579ll,12677597984ll,13427658757ll,14413668440ll,15056100823ll,15644184848ll,16159150895ll,17401785340ll,18037854869ll,18754203478ll,19118578421ll,19843362252ll,20218325249ll,20589484068ll,20786140473ll,22233480430ll,23024630341ll,23788251108ll,24201722665ll,24934548070ll,25373616021ll,25771137064ll,26000074043ll,26713004470ll,27177522087ll,27587636974ll,0ll,625238784ll,974794670ll,1334685190ll,1526743394ll,1988534642ll,2249776166ll,2512092774ll,2656262470ll,3174725562ll,3473166336ll,3756153028ll,3924301012ll,4209037720ll,4385786998ll,4547290442ll,4645913084ll,5191040466ll,5585261892ll,5919256328ll,6134333890ll,6433657522ll,6663889362ll,6851479866ll,6982255638ll,7262749308ll,7528427382ll,7726017702ll,7872699936ll,8035129862ll,8185930558ll,8293896274ll,8377995706ll,9334376820ll,11006087870ll,12080767504ll,12965940702ll,13751196260ll,14826917398ll,15493883368ll,16082252280ll,16597513304ll,17840401700ll,18476884656ll,19193510186ll,19558161558ll,20283233024ll,20658661012ll,21030132170ll,21227095848ll,22674761896ll,23466275742ll,24230232382ll,24643979140ll,25377101532ll,25816511802ll,26214464064ll,26443792760ll,27157024362ll,27621813506ll,28032246948ll,0ll,670079719ll,1047549924ll,1436158113ll,1657930338ll,2143324915ll,2404851204ll,2667474643ll,2811979884ll,3330744761ll,3629582308ll,3912871361ll,4081312626ll,4366343479ll,4543461654ll,4705373465ll,4804400276ll,5349843479ll,5744349892ll,6078673923ll,6294172676ll,6593756653ll,6824331650ll,7012415131ll,7143539582ll,7424357449ll,7690307010ll,7888190763ll,8035129862ll,8199591045ll,8350697338ll,8459055029ll,8543483486ll,9543312979ll,11287733208ll,12419602189ll,13363296780ll,14216971915ll,15315419832ll,15982683755ll,16571335276ll,17086915933ll,18330240450ll,18967021399ll,19683929822ll,20048860619ll,20774424824ll,21150305161ll,21522068374ll,21719351973ll,23167346010ll,23959324547ll,24723571352ll,25137591307ll,25871301290ll,26311160283ll,26709491534ll,26939131251ll,27652721050ll,28117818565ll,28528575470ll,0ll,716110832ll,1115737952ll,1554905956ll,1800923756ll,2286618174ll,2548432030ll,2811347392ll,2956207500ll,3475302504ll,3774449172ll,4058052710ll,4226842722ll,4512177952ll,4689552124ll,4851771930ll,4951116678ll,5496898076ll,5891712974ll,6226354722ll,6442149786ll,6742072578ll,6972905156ll,7161308750ll,7292929268ll,7574174240ll,7840389240ll,8038561828ll,8185930558ll,8350697338ll,8503870572ll,8612496454ll,8697280358ll,9740854110ll,11569412274ll,12759946202ll,13792281056ll,14667687356ll,15766492246ll,16434119624ll,17023062306ll,17538948248ll,18782616490ll,19419745000ll,20136945018ll,20502333110ll,21228361332ll,21604610718ll,21976840086ll,22174475784ll,23622838828ll,24415175034ll,25179766328ll,25594119072ll,26328451268ll,26768985792ll,27167769486ll,27398048306ll,28112017420ll,28577446664ll,28988579222ll,0ll,763486909ll,1190005868ll,1654406813ll,1900708674ll,2386716025ll,2648801530ll,2912144019ll,3057332922ll,3576750483ll,3876182072ll,4160223841ll,4329410036ll,4615031927ll,4792706920ll,4955237045ll,5054925378ll,5601026865ll,5996179638ll,6331140561ll,6547275376ll,6847639405ll,7078745444ll,7267456781ll,7399564596ll,7681226449ll,7947708838ll,8146193385ll,8293896274ll,8459055029ll,8612496454ll,8723321965ll,8808412442ll,9896231911ll,11796450314ll,13055258131ll,14109513822ll,14985208347ll,16084371990ll,16752347449ll,17341602824ll,17857791157ll,19101826652ll,19739254949ll,20456788408ll,20822587515ll,21548998342ll,21925562737ll,22298142560ll,22496096825ll,23944815514ll,24737519891ll,25502397454ll,25917229161ll,26652175094ll,27093145443ll,27492254858ll,27723136351ll,28437557168ll,28903364027ll,29314797218ll,0ll,811607982ll,1264697142ll,1729396692ll,1975994418ll,2462300926ll,2724745138ll,2988445316ll,3133967114ll,3653716548ll,3953504702ll,4238004404ll,4407706924ll,4693700950ll,4871691120ll,5034557596ll,5134563112ll,5680966836ll,6076417116ll,6411718542ll,6628269484ll,6929064524ll,7160655874ll,7349797180ll,7482237958ll,7764272114ll,8031185300ll,8229984178ll,8377995706ll,8543483486ll,8697280358ll,8808412442ll,8895723800ll,10027783970ll,12016568086ll,13297364386ll,14351912702ll,15227903714ll,16327347574ll,16995642632ll,17585214544ll,18101747858ll,19346086266ll,19983970104ll,20701799430ll,21067904774ll,21794756074ll,22171681016ll,22544588286ll,22742857404ll,24191917738ll,24984942348ll,25750232318ll,26165442154ll,26900710434ll,27342323790ll,27741722690ll,27972923088ll,28687673124ll,29153770018ll,29565558410ll,0ll,862174745ll,1339929572ll,1829850397ll,2102503784ll,2615399437ll,2904940488ll,3196734687ll,3370804152ll,3919737201ll,4249170612ll,4563384285ll,4765010108ll,5083472337ll,5294548230ll,5491136365ll,5625261940ll,6206681433ll,6637940362ll,7009276205ll,7262798914ll,7600605791ll,7869984984ll,8098868995ll,8271559158ll,8594498937ll,8902853468ll,9143291203ll,9334376820ll,9543312979ll,9740854110ll,9896231911ll,10027783970ll,11230384629ll,13242650450ll,14523717835ll,15578554714ll,16454829657ll,17554599066ll,18223163997ll,18813036732ll,19329874587ll,20574577058ll,21212844251ll,21930960500ll,22297387077ll,23024620594ll,23401834953ll,23775044336ll,23973614573ll,25423107862ll,26216495759ll,26982185592ll,27397702311ll,28133285396ll,28575543969ll,28975449986ll,29206974167ll,29922086334ll,30388566899ll,30800717716ll,0ll,914838526ll,1424756182ll,1972075540ll,2279451312ll,2852089542ll,3179214498ll,3532716530ll,3747590138ll,4359782312ll,4733646072ll,5111329234ll,5362037328ll,5746134160ll,6008792844ll,6272604198ll,6461275536ll,7111061232ll,7600953990ll,8041015688ll,8357144024ll,8763526766ll,9099322496ll,9398727192ll,9643716080ll,10038444040ll,10422505738ll,10734297148ll,11006087870ll,11287733208ll,11569412274ll,11796450314ll,12016568086ll,13242650450ll,15257236072ll,16538597142ll,17593705332ll,18470294782ll,19570357800ll,20239192644ll,20829375808ll,21346485938ll,22591624036ll,23230241870ll,23948641276ll,24315320250ll,25042874678ll,25420422612ll,25793899344ll,25992761436ll,27442913486ll,28236820976ll,29002802470ll,29418613620ll,30154532226ll,30597184004ll,30997414096ll,31229269842ll,31944757780ll,32411597914ll,32824071128ll,0ll,968366587ll,1501767640ll,2084341879ll,2391966442ll,3025134285ll,3377831842ll,3772711221ll,3987807100ll,4664032081ll,5065908352ll,5491634393ll,5742997472ll,6193121923ll,6487750060ll,6805005371ll,6996079542ll,7712063573ll,8239175524ll,8736533753ll,9058840994ll,9527883917ll,9907904394ll,10268250995ll,10525373504ll,10980684575ll,11416600508ll,11792677579ll,12080767504ll,12419602189ll,12759946202ll,13055258131ll,13297364386ll,14523717835ll,16538597142ll,17822343321ll,18877764932ll,19754659433ll,20854989028ll,21524111373ll,22114584844ll,22631975415ll,23877416784ll,24516455705ll,25235143842ll,25602097093ll,26329953100ll,26707829843ll,27081611086ll,27280815587ll,28731241690ll,29525818993ll,30292205342ll,30708505315ll,31444811266ll,31887806347ll,32288315128ll,32520541619ll,33236396340ll,33703668641ll,34116487018ll,0ll,1023771930ll,1593854530ll,2176688896ll,2484589240ll,3180239108ll,3575409640ll,3970561580ll,4185926028ll,4928185156ll,5379187614ll,5805597966ll,6057213726ll,6575120062ll,6926066762ll,7245694666ll,7437064258ll,8220943016ll,8811750690ll,9314674282ll,9637268910ll,10170396152ll,10621028132ll,10994483708ll,11251876632ll,11769095614ll,12285188260ll,12677597984ll,12965940702ll,13363296780ll,13792281056ll,14109513822ll,14351912702ll,15578554714ll,17593705332ll,18877764932ll,19935649016ll,20812842416ll,21913492106ll,22582893340ll,23173709664ll,23691363574ll,24937091142ll,25576381616ll,26295517682ll,26662795684ll,27390895332ll,27769061478ll,28143169670ll,28342732858ll,29793486816ll,30588361868ll,31355159858ll,31772198512ll,32508976574ll,32952294160ll,33353101420ll,33585624762ll,34301770766ll,34769379420ll,35182505090ll,0ll,1079828725ll,1671015968ll,2275329913ll,2605384694ll,3344387577ll,3739783898ll,4135185593ll,4350829232ll,5159690179ll,5636026174ll,6087552753ll,6365803264ll,6939199497ll,7292455608ll,7612376257ll,7804035470ll,8656180083ll,9281740070ll,9814606133ll,10167834966ll,10762302145ll,11224530918ll,11598250005ll,11855913054ll,12435337789ll,13001560382ll,13427658757ll,13751196260ll,14216971915ll,14667687356ll,14985208347ll,15227903714ll,16454829657ll,18470294782ll,19754659433ll,20812842416ll,21692574365ll,22793492556ll,23463168493ll,24054246864ll,24572189559ll,25818178800ll,26457726135ll,27177138354ll,27544821729ll,28273204542ll,28651729353ll,29026205638ll,29226116409ll,30677159946ll,31472437899ll,32240000546ll,32657496297ll,33394565214ll,33838255749ll,34239511988ll,34472334085ll,35188818486ll,35656747901ll,36070310494ll,0ll,1136843756ll,1770440234ll,2436571426ll,2812002824ll,3551282570ll,3946955526ll,4342675948ll,4558582430ll,5435008446ll,5966089750ll,6486301664ll,6823596440ll,7399698956ll,7753259310ll,8073486134ll,8265458080ll,9186719012ll,9881403182ll,10489306360ll,10914778690ll,11520016854ll,11982533996ll,12356547028ll,12614532844ll,13256744908ll,13907598258ll,14413668440ll,14826917398ll,15315419832ll,15766492246ll,16084371990ll,16327347574ll,17554599066ll,19570357800ll,20854989028ll,21913492106ll,22793492556ll,23897000252ll,24566933056ll,25158311904ll,25676582758ll,26922915652ll,27562794378ll,28282454866ll,28650429108ll,29379096400ll,29758083806ll,30132924752ll,30333177500ll,31784531790ll,32580202790ll,33348086546ll,33765890742ll,34503240178ll,34947189808ll,35349121716ll,35582541240ll,36299342978ll,36767619294ll,37181482556ll,0ll,1196336605ll,1847219398ll,2561254695ll,2936912474ll,3676456871ll,4072397760ll,4468370537ll,4684545894ll,5630957943ll,6183709970ll,6762339403ll,7102992566ll,7679384149ll,8033266340ll,8353801485ll,8546106692ll,9538970481ll,10265029876ll,10938511935ll,11374941964ll,11980450161ll,12443239550ll,12817549095ll,13075841710ll,13782652749ll,14481754384ll,15056100823ll,15493883368ll,15982683755ll,16434119624ll,16752347449ll,16995642632ll,18223163997ll,20239192644ll,21524111373ll,22582893340ll,23463168493ll,24566933056ll,25239503825ll,25831215230ll,26349745563ll,27596399438ll,28236616561ll,28956567768ll,29324885199ll,30054028270ll,30433367349ll,30808562420ll,31009131331ll,32460873534ll,33256887221ll,34025045430ll,34443257217ll,35180991270ll,35625211509ll,36027421958ll,36261538711ll,36978884508ll,37447533617ll,37861726564ll,0ll,1256381288ll,1956837368ll,2671159624ll,3047075826ll,3786935942ll,4183135406ll,4579377244ll,4795833412ll,5812757490ll,6427538596ll,7008734216ll,7349682610ll,7926368218ll,8280560992ll,8601430298ll,8794056546ll,9858958042ll,10660865004ll,11344372850ll,11781077572ll,12386876596ll,12849978530ll,13224611924ll,13483228612ll,14254970918ll,15045207250ll,15644184848ll,16082252280ll,16571335276ll,17023062306ll,17341602824ll,17585214544ll,18813036732ll,20829375808ll,22114584844ll,23173709664ll,24054246864ll,25158311904ll,25831215230ll,26425643864ll,26944430300ll,28191337594ll,28831848232ll,29552117424ll,29920815860ll,30650315902ll,31029993450ll,31405539098ll,31606578188ll,33058641340ll,33854955118ll,34623413606ll,35041915708ll,35780414078ll,36225161046ll,36627710606ll,36862153448ll,37579800644ll,38048743320ll,38463238106ll,0ll,1317713203ll,2030004380ll,2756364197ll,3144811750ll,3897331653ll,4306486460ll,4715986969ll,4945936648ll,6026099421ll,6643255350ll,7224743039ll,7565984004ll,8142970533ll,8497496618ll,8818668727ll,9011578734ll,10149640193ll,10977975986ll,11677880207ll,12131499400ll,12754362127ll,13234816804ll,13627136499ll,13903587106ll,14743529503ll,15559894358ll,16159150895ll,16597513304ll,17086915933ll,17538948248ll,17857791157ll,18101747858ll,19329874587ll,21346485938ll,22631975415ll,23691363574ll,24572189559ll,25676582758ll,26349745563ll,26944430300ll,27465957213ll,28713152168ll,29353996281ll,30074650472ll,30443685433ll,31173534044ll,31553510013ll,31929538568ll,32130917071ll,33583280376ll,34380019911ll,35148803232ll,35567617017ll,36306405414ll,36751916651ll,37154975750ll,37389694221ll,38107615764ll,38576890673ll,38991760232ll,0ll,1379320934ll,2149961952ll,2943146462ll,3392914280ll,4214759412ll,4688071714ll,5169653104ll,5467013902ll,6549765450ll,7167268630ll,7749133868ll,8090653822ll,8667963282ll,9022799822ll,9344247678ll,9537458466ll,10748924206ll,11660479686ll,12445807250ll,12985260944ll,13694923264ll,14262742962ll,14747068478ll,15117405326ll,15985459044ll,16802189604ll,17401785340ll,17840401700ll,18330240450ll,18782616490ll,19101826652ll,19346086266ll,20574577058ll,22591624036ll,23877416784ll,24937091142ll,25818178800ll,26922915652ll,27596399438ll,28191337594ll,28713152168ll,29963182400ll,30604289116ll,31325236400ll,31694556466ll,32424682968ll,32804989118ll,33181293472ll,33382999324ll,34835803570ll,35632867752ll,36401948464ll,36821090404ll,37560217736ll,38006060194ll,38409418218ll,38644429462ll,39362700468ll,39832309848ll,40247492632ll,0ll,1439303311ll,2210179474ll,3068576207ll,3519004490ll,4408297083ll,4883043816ll,5433945329ll,5733881748ll,6816958427ll,7434754884ll,8016875013ll,8358703174ll,8936300397ll,9291598398ll,9613408755ll,9807011062ll,11090612119ll,12016965662ll,12872972641ll,13431624144ll,14208771911ll,14801996370ll,15351429441ll,15752560788ll,16620924425ll,17437996032ll,18037854869ll,18476884656ll,18967021399ll,19419745000ll,19739254949ll,19983970104ll,21212844251ll,23230241870ll,24516455705ll,25576381616ll,26457726135ll,27562794378ll,28236616561ll,28831848232ll,29353996281ll,30604289116ll,31248287069ll,31969522818ll,32339104489ll,33069567004ll,33450216739ll,33826862030ll,34028870979ll,35481978784ll,36279522575ll,37048961804ll,37468423657ll,38207856058ll,38654101669ll,39057784276ll,39293125721ll,40011740066ll,40481684889ll,40897149166ll,0ll,1508074118ll,2351928318ll,3211034502ll,3661713362ll,4627164056ll,5180937700ll,5735198134ll,6035429262ll,7118859576ll,7736945032ll,8319364886ll,8661471222ll,9239334596ll,9594931274ll,9917024554ll,10110927866ll,11474001660ll,12498512212ll,13375662052ll,13934572822ll,14785805772ll,15480968220ll,16066553906ll,16467965544ll,17336602842ll,18153930320ll,18754203478ll,19193510186ll,19683929822ll,20136945018ll,20456788408ll,20701799430ll,21930960500ll,23948641276ll,25235143842ll,26295517682ll,27177138354ll,28282454866ll,28956567768ll,29552117424ll,30074650472ll,31325236400ll,31969522818ll,32693698100ll,33063540522ll,33794263230ll,34175250392ll,34552223234ll,34754619394ll,36208038272ll,37005910528ll,37775631256ll,38195563750ll,38935357518ll,39381889068ll,39785864008ll,40021560404ll,40740508038ll,41210718644ll,41626501750ll,0ll,1578314363ll,2422742568ll,3282096321ll,3733029238ll,4776128211ll,5332576040ll,5887133191ll,6187658028ll,7271362265ll,7889732428ll,8472426459ll,8814782622ll,9392922089ll,9748904898ll,10071336047ll,10265565758ll,11709298385ll,12753622392ll,13631030925ll,14190221830ll,15116544925ll,15843807334ll,16429668553ll,16831378538ll,17700305925ll,18518034004ll,19118578421ll,19558161558ll,20048860619ll,20502333110ll,20822587515ll,21067904774ll,22297387077ll,24315320250ll,25602097093ll,26662795684ll,27544821729ll,28650429108ll,29324885199ll,29920815860ll,30443685433ll,31694556466ll,32339104489ll,33063540522ll,33436385889ll,34167440876ll,34548731093ll,34926086006ll,35128845273ll,36582598312ll,37380798251ll,38151004628ll,38571291243ll,39311359278ll,39758220629ll,40162567254ll,40398638019ll,41117871090ll,41588368421ll,42004441006ll,0ll,1650013408ll,2569912062ll,3506136000ll,4035701846ll,5081171766ll,5637899048ll,6192757766ll,6493583354ll,7577581694ll,8196246096ll,8779215092ll,9121865720ll,9700287600ll,10056634622ll,10379424792ll,10573988000ll,12099530762ll,13244168498ll,14222205286ll,14884244624ll,15839293320ll,16566906172ll,17153107946ll,17555123672ll,18424385878ll,19242465858ll,19843362252ll,20283233024ll,20774424824ll,21228361332ll,21548998342ll,21794756074ll,23024620594ll,25042874678ll,26329953100ll,27390895332ll,28273204542ll,29379096400ll,30054028270ll,30650315902ll,31173534044ll,32424682968ll,33069567004ll,33794263230ll,34167440876ll,34901560984ll,35283123070ll,35660779040ll,35863886626ll,37317991168ll,38116496570ll,38887011812ll,39307580774ll,40048086832ll,40495323364ll,40899956244ll,41136489062ll,41856586516ll,42327617012ll,42744013458ll,0ll,1723239749ll,2644572028ll,3659382531ll,4191330348ll,5237081669ll,5794159632ll,6349319197ll,6650483368ll,7734790141ll,8353939148ll,8937229005ll,9280270516ll,9859073431ll,10215897694ll,10539058377ll,10733960606ll,12342584597ll,13508836426ll,14567893453ll,15256944562ll,16212303027ll,16940270180ll,17526816705ll,17929130664ll,18798715297ll,19617131416ll,20218325249ll,20658661012ll,21150305161ll,21604610718ll,21925562737ll,22171681016ll,23401834953ll,25420422612ll,26707829843ll,27769061478ll,28651729353ll,29758083806ll,30433367349ll,31029993450ll,31553510013ll,32804989118ll,33450216739ll,34175250392ll,34548731093ll,35283123070ll,35667864553ll,36045866542ll,36249298555ll,37703700788ll,38502611095ll,39273431292ll,39694327633ll,40435159316ll,40882791047ll,41287910784ll,41524787479ll,42245187512ll,42716981951ll,43134017472ll,0ll,1797767306ll,2796409034ll,3813622236ll,4345870056ll,5391918630ll,5949303390ll,6504797150ll,6806269640ll,7890864402ll,8510331374ll,9093908774ll,9437256694ll,10016389364ll,10373567756ll,10697027522ll,10892244724ll,12584865666ll,13852733114ll,14936595402ll,15625928206ll,16581588146ll,17309869512ll,17896719206ll,18299337416ll,19169250360ll,19987955912ll,20589484068ll,21030132170ll,21522068374ll,21976840086ll,22298142560ll,22544588286ll,23775044336ll,25793899344ll,27081611086ll,28143169670ll,29026205638ll,30132924752ll,30808562420ll,31405539098ll,31929538568ll,33181293472ll,33826862030ll,34552223234ll,34926086006ll,35660779040ll,36045866542ll,36427082160ll,36630792974ll,38085490978ll,38884702972ll,39655812688ll,40077068828ll,40818207554ll,41266316580ll,41671817288ll,41909131834ll,42629938166ll,43102154054ll,43519467870ll,0ll,1874097743ll,2875707214ll,3893219363ll,4425754808ll,5472103957ll,6029824002ll,6585623273ll,6887384350ll,7972272149ll,8592135886ll,9176036825ll,9519716064ll,10099166297ll,10456686996ll,10780496909ll,10976019702ll,12754245185ll,14046388418ll,15130526943ll,15820155850ll,16776130017ll,17504705614ll,18091843393ll,18494833028ll,19365057255ll,20184223130ll,20786140473ll,21227095848ll,21719351973ll,22174475784ll,22496096825ll,22742857404ll,23973614573ll,25992761436ll,27280815587ll,28342732858ll,29226116409ll,30333177500ll,31009131331ll,31606578188ll,32130917071ll,33382999324ll,34028870979ll,34754619394ll,35128845273ll,35863886626ll,36249298555ll,36630792974ll,36837794513ll,38292761116ll,39092301181ll,39863772350ll,40285402285ll,41027009526ll,41475469995ll,41881398788ll,42119142049ll,42840278366ll,43312811969ll,43730934190ll,0ll,1952029758ll,3032824276ll,4130850224ll,4745617662ll,5875453374ll,6518035676ll,7160617068ll,7550391208ll,8724798616ll,9435331808ll,10110327168ll,10548785916ll,11224217564ll,11678921608ll,12101261994ll,12396088190ll,14198114394ll,15490758884ll,16575337150ll,17265237152ll,18221512704ll,18950358014ll,19537782440ll,19941044452ll,20811661420ll,21631180716ll,22233480430ll,22674761896ll,23167346010ll,23622838828ll,23944815514ll,24191917738ll,25423107862ll,27442913486ll,28731241690ll,29793486816ll,30677159946ll,31784531790ll,32460873534ll,33058641340ll,33583280376ll,34835803570ll,35481978784ll,36208038272ll,36582598312ll,37317991168ll,37703700788ll,38085490978ll,38292761116ll,39751057140ll,40550878538ll,41322636112ll,41744568732ll,42486545544ll,42935279506ll,43341577024ll,43579620078ll,44301064958ll,44773891320ll,45192328958ll,0ll,2031041435ll,3116246290ll,4298799179ll,4919142056ll,6135451835ll,6785109782ll,7515634583ll,7914490896ll,9177805063ll,9899912624ll,10662589321ll,11117349012ll,11881876021ll,12354940124ll,12866333997ll,13183055322ll,14985533939ll,16278583268ll,17363522217ll,18054137926ll,19010878161ll,19739986628ll,20327657141ll,20731215868ll,21602121573ll,22422001728ll,23024630341ll,23466275742ll,23959324547ll,24415175034ll,24737519891ll,24984942348ll,26216495759ll,28236820976ll,29525818993ll,30588361868ll,31472437899ll,32580202790ll,33256887221ll,33854955118ll,34380019911ll,35632867752ll,36279522575ll,37005910528ll,37380798251ll,38116496570ll,38502611095ll,38884702972ll,39092301181ll,40550878538ll,41354080009ll,42126120972ll,42548365927ll,43290634392ll,43739672617ll,44146260658ll,44384620689ll,45106341690ll,45579472273ll,45998224872ll,0ll,2111879366ll,3277281100ll,4466017070ll,5086642584ll,6391298444ll,7126618080ll,7866863298ll,8265975284ll,9620026206ll,10433430480ll,11211102680ll,11666124168ll,12521490254ll,13092195602ll,13625430668ll,13942430946ll,15745175890ll,17038576448ll,18123818668ll,18814844992ll,19771864308ll,20501230206ll,21089551626ll,21493596210ll,22365083908ll,23185318414ll,23788251108ll,24230232382ll,24723571352ll,25179766328ll,25502397454ll,25750232318ll,26982185592ll,29002802470ll,30292205342ll,31355159858ll,32240000546ll,33348086546ll,34025045430ll,34623413606ll,35148803232ll,36401948464ll,37048961804ll,37775631256ll,38151004628ll,38887011812ll,39273431292ll,39655812688ll,39863772350ll,41322636112ll,42126120972ll,42901641708ll,43324230578ll,44066858286ll,44516178802ll,44923086502ll,45161764206ll,45883791982ll,46357231020ll,46776262048ll,0ll,2193671779ll,3365867606ll,4554882051ll,5175820758ll,6569733045ll,7314732588ll,8055232541ll,8454615334ll,9900201845ll,10728098286ll,11506032969ll,11961339366ll,12908200509ll,13500539240ll,14034055597ll,14351356726ll,16154378477ll,17448444400ll,18534162421ll,19225491362ll,20182814277ll,20912474764ll,21501208481ll,21905835770ll,22777712945ll,23598329976ll,24201722665ll,24643979140ll,25137591307ll,25594119072ll,25917229161ll,26165442154ll,27397702311ll,29418613620ll,30708505315ll,31772198512ll,32657496297ll,33765890742ll,34443257217ll,35041915708ll,35567617017ll,36821090404ll,37468423657ll,38195563750ll,38571291243ll,39307580774ll,39694327633ll,40077068828ll,40285402285ll,41744568732ll,42548365927ll,43324230578ll,43750380569ll,44493292204ll,44942930255ll,45350151020ll,45589167275ll,46311489284ll,46785232901ll,47204583044ll,0ll,2276770508ll,3528716602ll,4798687738ll,5502192048ll,6906700926ll,7651978856ll,8392769716ll,8792451474ll,10330784998ll,11248945452ll,12117387048ll,12666932552ll,13636461186ll,14229137302ll,14762969286ll,15080553882ll,16883886462ll,18178411084ll,19264405694ll,19956034026ll,20913639680ll,21643591452ll,22232605398ll,22637621238ll,23509838430ll,24330821156ll,24934548070ll,25377101532ll,25871301290ll,26328451268ll,26652175094ll,26900710434ll,28133285396ll,30154532226ll,31444811266ll,32508976574ll,33394565214ll,34503240178ll,35180991270ll,35780414078ll,36306405414ll,37560217736ll,38207856058ll,38935357518ll,39311359278ll,40048086832ll,40435159316ll,40818207554ll,41027009526ll,42486545544ll,43290634392ll,44066858286ll,44493292204ll,45239780468ll,45689693490ll,46097225954ll,46336547506ll,47059356068ll,47533416426ll,47953064478ll,0ll,2362650307ll,3625171034ll,4986725705ll,5702220956ll,7107024291ll,7852565842ll,8593647259ll,8993657634ll,10627670643ll,11564891314ll,12527498937ll,13101327122ll,14071184859ll,14664188404ll,15198349919ll,15516261476ll,17319865509ll,18614651272ll,19700891665ll,20392812774ll,21350712149ll,22080977620ll,22670336475ll,23075674302ll,23948197887ll,24769516118ll,25373616021ll,25816511802ll,26311160283ll,26768985792ll,27093145443ll,27342323790ll,28575543969ll,30597184004ll,31887806347ll,32952294160ll,33838255749ll,34947189808ll,35625211509ll,36225161046ll,36751916651ll,38006060194ll,38654101669ll,39381889068ll,39758220629ll,40495323364ll,40882791047ll,41266316580ll,41475469995ll,42935279506ll,43739672617ll,44516178802ll,44942930255ll,45689693490ll,46143240385ll,46551052656ll,46790693601ll,47513774394ll,47988383839ll,48408427686ll,0ll,2449778924ll,3793290222ll,5166874336ll,5882625548ll,7287720602ll,8033547024ll,8774977100ll,9175298894ll,10906136110ll,11934594544ll,12919372540ll,13493485072ll,14463650990ll,15056981236ll,15591467528ll,15909670922ll,17713570138ll,19008609248ll,20095482276ll,20787906992ll,21746260058ll,22476828696ll,23066535088ll,23472217422ll,24345085114ll,25166748744ll,25771137064ll,26214464064ll,26709491534ll,27167769486ll,27492254858ll,27741722690ll,28975449986ll,30997414096ll,32288315128ll,33353101420ll,34239511988ll,35349121716ll,36027421958ll,36627710606ll,37154975750ll,38409418218ll,39057784276ll,39785864008ll,40162567254ll,40899956244ll,41287910784ll,41671817288ll,41881398788ll,43341577024ll,44146260658ll,44923086502ll,45350151020ll,46097225954ll,46551052656ll,46962619060ll,47202530264ll,47925886730ll,48400856446ll,48821349554ll,0ll,2538434079ll,3894617276ll,5268464759ll,5984482702ll,7389877471ll,8136029326ll,8877770909ll,9278368110ll,11107487681ll,12157579306ll,13142638175ll,13717048816ll,14687499517ll,15281155246ll,15815930535ll,16134516908ll,17938688777ll,19234016026ll,20321424023ll,21014246684ll,21973067741ll,22703956796ll,23293992793ll,23700054956ll,24573214365ll,25395219584ll,26000074043ll,26443792760ll,26939131251ll,27398048306ll,27723136351ll,27972923088ll,29206974167ll,31229269842ll,32520541619ll,33585624762ll,34472334085ll,35582541240ll,36261538711ll,36862153448ll,37389694221ll,38644429462ll,39293125721ll,40021560404ll,40398638019ll,41136489062ll,41524787479ll,41909131834ll,42119142049ll,43579620078ll,44384620689ll,45161764206ll,45589167275ll,46336547506ll,46790693601ll,47202530264ll,47446213925ll,48169872352ll,48645165309ll,49066072066ll,0ll,2628251382ll,4065679406ll,5521869348ll,6321784548ll,7812095558ll,8644330156ll,9473948466ll,9963404534ll,11814309352ll,12864694304ll,13850069986ll,14424789534ll,15395612274ll,15989584674ll,16524722294ll,16843606662ll,18648197536ll,19943835526ll,21031581526ll,21724904208ll,22684060226ll,23415277468ll,24005668678ll,24412024446ll,25285498996ll,26107821396ll,26713004470ll,27157024362ll,27652721050ll,28112017420ll,28437557168ll,28687673124ll,29922086334ll,31944757780ll,33236396340ll,34301770766ll,35188818486ll,36299342978ll,36978884508ll,37579800644ll,38107615764ll,39362700468ll,40011740066ll,40740508038ll,41117871090ll,41856586516ll,42245187512ll,42629938166ll,42840278366ll,44301064958ll,45106341690ll,45883791982ll,46311489284ll,47059356068ll,47513774394ll,47925886730ll,48169872352ll,48897393216ll,49372983984ll,49794208518ll,0ll,2718503929ll,4171705146ll,5723965803ll,6541312016ll,8129394837ll,8981157352ll,9909733703ll,10421346816ll,12272566077ll,13323312738ll,14308992203ll,14884063980ll,15855225353ll,16449549332ll,16984973253ll,17304331484ll,19109281741ll,20405269952ll,21493362575ll,22187046792ll,23146651547ll,23878178434ll,24468923305ll,24875623328ll,25749440889ll,26572033458ll,27177522087ll,27621813506ll,28117818565ll,28577446664ll,28903364027ll,29153770018ll,30388566899ll,32411597914ll,33703668641ll,34769379420ll,35656747901ll,36767619294ll,37447533617ll,38048743320ll,38576890673ll,39832309848ll,40481684889ll,41210718644ll,41588368421ll,42327617012ll,42716981951ll,43102154054ll,43312811969ll,44773891320ll,45579472273ll,46357231020ll,46785232901ll,47533416426ll,47988383839ll,48400856446ll,48645165309ll,49372983984ll,49852472533ll,50273966108ll,0ll,2811912478ll,4345313948ll,5917068192ll,6734673648ll,8423805042ll,9360315550ll,10313211738ll,10825105844ll,12676644534ll,13727689576ll,14713722110ll,15289085848ll,16260573538ll,16855186296ll,17390935324ll,17710656468ll,19515948668ll,20812277870ll,21900677240ll,22594755504ll,23554671134ll,24286551804ll,24877624390ll,25284779892ll,26158968548ll,26981861056ll,27587636974ll,28032246948ll,28528575470ll,28988579222ll,29314797218ll,29565558410ll,30800717716ll,32824071128ll,34116487018ll,35182505090ll,36070310494ll,37181482556ll,37861726564ll,38463238106ll,38991760232ll,40247492632ll,40897149166ll,41626501750ll,42004441006ll,42744013458ll,43134017472ll,43519467870ll,43730934190ll,45192328958ll,45998224872ll,46776262048ll,47204583044ll,47953064478ll,48408427686ll,48821349554ll,49066072066ll,49794208518ll,50273966108ll,50699448476ll 17 }; 18 19 int main() 20 { 21 int T; scanf("%d",&T); 22 while(T--) { 23 scanf("%d%d",&n,&m); 24 ll res=0; 25 FOR(i,1,61) FOR(j,1,61) 26 if(i*250>n&&j*250>m) { 27 i--,j--; 28 res=ans[i][j]; 29 FOR(x,1,i*250) FOR(y,j*250+1,m) 30 res+=gcd(x&y,x|y); 31 FOR(x,i*250+1,n) FOR(y,1,m) 32 res+=gcd(x&y,x|y); 33 i=j=62; 34 } 35 printf("%I64d\n",res); 36 } 37 return 0; 38 }
DZY Loves Connecting
【思路】
树形DP
设f[u]表示经过u的所有连续集的大小之和,cnt[u]表示经过u的所有连续集的个数。枚举u的每一个儿子,假设已经统计完前S-1个儿子,则有转移式:
f[u]=f[u]+f[u]*cnt[v]+f[v]*cnt[u]
cnt[u]=cnt[u]+cnt[u]*cnt[v]
感觉跟树分治的统计信息类似,大概就是因为信息可以直接由dp得出所以才采用的树DP而不是树分治。
【代码】
1 #include<set> 2 #include<cmath> 3 #include<queue> 4 #include<vector> 5 #include<cstdio> 6 #include<cstring> 7 #include<iostream> 8 #include<algorithm> 9 //#pragma comment(linker, "/STACK:102400000,102400000") 10 #define trav(u,i) for(int i=front[u];i;i=e[i].nxt) 11 #define FOR(a,b,c) for(int a=(b);a<=(c);a++) 12 using namespace std; 13 14 typedef long long ll; 15 const int N = 3e5+10; 16 const int M = N<<1; 17 const int MOD = 1e9+7; 18 19 ll read() { 20 char c=getchar(); 21 ll f=1,x=0; 22 while(!isdigit(c)) { 23 if(c=='-') f=-1; c=getchar(); 24 } 25 while(isdigit(c)) 26 x=x*10+c-'0',c=getchar(); 27 return x*f; 28 } 29 struct Edge { 30 int v,nxt; 31 Edge(int v=0,int nxt=0):v(v),nxt(nxt){} 32 }e[M]; 33 int en=1,front[N]; 34 void adde(int u,int v) 35 { 36 e[++en]=Edge(v,front[u]); front[u]=en; 37 } 38 39 int n; 40 ll f[N],cnt[N]; 41 42 void dp(int u,int fa) 43 { 44 cnt[u]=f[u]=1; 45 int v; 46 trav(u,i) if((v=e[i].v)!=fa) { 47 dp(v,u); 48 f[u]=(f[u]*(cnt[v]+1)%MOD+cnt[u]*f[v]%MOD)%MOD; 49 cnt[u]=cnt[u]*(cnt[v]+1)%MOD; 50 } 51 } 52 53 int main() 54 { 55 int T=read(); 56 while(T--) { 57 n=read(); 58 en=1; memset(front,0,sizeof(front)); 59 FOR(i,2,n) { 60 int v=read(); 61 adde(i,v),adde(v,i); 62 } 63 ll ans=0; 64 dp(1,-1); 65 FOR(i,1,n) ans=(ans+f[i])%MOD; 66 printf("%I64d\n",ans); 67 } 68 return 0; 69 }
DZY Loves Sorting
【思路】
二分+线段树
二分最终a[k]的值为mid,依次进行每一个操作,对于0号操作,统计区间[l,r]内比mid大的点数为x,将[l,r-x]设为0,[r-x+1,r]设为1,1号操作类似。然后用线段树提供区间赋值与区间查询的操作。
最终看a[k]==0?,如果成立则a[k]可能更小,因为
000[0]00111
01分界处为mid,[]为a[k]
太神辣,奇技淫巧系列+1
【代码】
1 #include<set> 2 #include<cmath> 3 #include<queue> 4 #include<vector> 5 #include<cstdio> 6 #include<cstring> 7 #include<iostream> 8 #include<algorithm> 9 #define trav(u,i) for(int i=front[u];i;i=e[i].nxt) 10 #define FOR(a,b,c) for(int a=(b);a<=(c);a++) 11 using namespace std; 12 13 typedef long long ll; 14 const int N = 2e5+10; 15 16 ll read() { 17 char c=getchar(); 18 ll f=1,x=0; 19 while(!isdigit(c)) { 20 if(c=='-') f=-1; c=getchar(); 21 } 22 while(isdigit(c)) 23 x=x*10+c-'0',c=getchar(); 24 return x*f; 25 } 26 27 struct Tnode { 28 int l,r,s,tag; 29 }T[N<<2]; 30 void pushdown(int u) { 31 if(T[u].tag!=-1&&T[u].l!=T[u].r) { 32 int lc=u<<1,rc=lc|1; 33 T[lc].tag=T[rc].tag=T[u].tag; 34 if(T[u].tag) { 35 T[lc].s=T[lc].r-T[lc].l+1; 36 T[rc].s=T[rc].r-T[rc].l+1; 37 } else 38 T[lc].s=T[rc].s=0; 39 T[u].tag=-1; 40 } 41 } 42 void maintain(int u) { 43 T[u].s=T[u<<1].s+T[u<<1|1].s; 44 } 45 void update(int u,int L,int R,int v) { 46 pushdown(u); 47 if(L<=T[u].l&&T[u].r<=R) { 48 T[u].tag=v; 49 if(v==1) T[u].s=T[u].r-T[u].l+1; 50 else T[u].s=0; 51 } else { 52 int mid=T[u].l+T[u].r>>1; 53 if(L<=mid) update(u<<1,L,R,v); 54 if(mid<R) update(u<<1|1,L,R,v); 55 maintain(u); 56 } 57 } 58 int query(int u,int L,int R) { 59 pushdown(u); 60 if(L<=T[u].l&&T[u].r<=R) return T[u].s; 61 else { 62 int mid=T[u].l+T[u].r>>1,ans=0;; 63 if(L<=mid) ans+=query(u<<1,L,R); 64 if(mid<R) ans+=query(u<<1|1,L,R); 65 return ans; 66 } 67 } 68 69 struct Node { 70 int op,l,r; 71 }q[N]; 72 int n,m,K,a[N],M; 73 74 void build(int u,int l,int r) 75 { 76 T[u].l=l,T[u].r=r; T[u].s=0; 77 T[u].tag=-1; 78 if(l==r) { T[u].s=a[l]>M; return ; } 79 int mid=l+r>>1; 80 build(u<<1,l,mid); 81 build(u<<1|1,mid+1,r); 82 maintain(u); 83 } 84 int can() 85 { 86 build(1,1,n); 87 FOR(i,1,m) { 88 if(q[i].op==0) { 89 int x=query(1,q[i].l,q[i].r); 90 update(1,q[i].l,q[i].r,0); 91 if(x) update(1,q[i].r-x+1,q[i].r,1); 92 } else { 93 int x=query(1,q[i].l,q[i].r); 94 update(1,q[i].l,q[i].r,0); 95 if(x) update(1,q[i].l,q[i].l+x-1,1); 96 } 97 } 98 return query(1,K,K)==0; 99 } 100 101 int main() 102 { 103 int kase=read(); 104 while(kase--) { 105 n=read(),m=read(); 106 int L=0,R=0,ans=0; 107 FOR(i,1,n) a[i]=read(),R=max(R,a[i]); 108 FOR(i,1,m) 109 q[i].op=read(),q[i].l=read(),q[i].r=read(); 110 K=read(); 111 while(L<=R) { 112 M=L+R>>1; 113 if(can()) R=M-1,ans=M; else L=M+1; 114 } 115 printf("%d\n",ans); 116 } 117 return 0; 118 }