2019.7.10 義烏模擬賽 T2 B
阿新 • • 發佈:2021-07-10
你會發現這個東西不太好做。
然後你想到它最多隻能有\(41\)的質數為因數。
然後就可以寫個爆搜大概是列舉因數。
你發現這個東西複雜度大概是\(O(能過)\),但是它有多測。
這個時候把表打出來就好了。
code:
#include<bits/stdc++.h> #define I inline #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define abs(x) ((x)>0?(x):-(x)) #define re register #define ll long long #define db double #define N 300 #define M 30 #define mod 1000000007 #define eps (1e-7) #define U unsigned int #define IT set<ques>::iterator #define Gc() getchar() #define Me(x,y) memset(x,y,sizeof(x)) using namespace std; int T,m=232;ll n; ll A[N+5]={897612484786617600,748010403988848000,673209363589963200,598408323191078400,448806242393308800,374005201994424000,363896953291872000,299204161595539200,224403121196654400,213717258282528000,181948476645936000,149602080797769600,145558781316748800,121298984430624000,112201560598327200,106858629141264000,90974238322968000,74801040398884800,72779390658374400,60649492215312000,48519593772249600,40432994810208000,36389695329187200,30324746107656000,24259796886124800,20216497405104000,18194847664593600,16173197924083200,12129898443062400,10108248702552000,8086598962041600,6064949221531200,5776142115744000,5198527904169600,4043299481020800,3912870465504000,3465685269446400,3032474610765600,2888071057872000,2599263952084800,2021649740510400,1956435232752000,1732842634723200,1565148186201600,1516237305382800,1444035528936000,1304290155168000,1155228423148800,1010824870255200,978217616376000,866421317361600,782574093100800,652145077584000,577614211574400,521716062067200,391287046550400,326072538792000,288807105787200,260858031033600,195643523275200,186327165024000,167694448521600,130429015516800,111796299014400,97821761637600,93163582512000,83847224260800,65214507758400,55898149507200,53970627110400,48910880818800,46581791256000,44975522592000,37265433004800,32607253879200,27949074753600,26985313555200,22487761296000,18632716502400,17990209036800,13492656777600,11243880648000,9316358251200,8995104518400,6746328388800,6425074656000,5782567190400,4497552259200,3855044793600,3373164194400,3212537328000,2891283595200,2248776129600,1927522396800,1686582097200,1606268664000,1285014931200,1124388064800,963761198400,642507465600,586637251200,481880599200,321253732800,293318625600,240940299600,195545750400,160626866400,146659312800,139675536000,128501493120,125707982400,97772875200,83805321600,80313433200,73329656400,69837768000,64250746560,55870214400,48886437600,41902660800,27935107200,20951330400,13967553600,10475665200,10291881600,9311702400,6983776800,5587021440,5145940800,4655851200,4410806400,4190266080,3491888400,2793510720,2572970400,2327925600,2205403200,2095133040,1470268800,1396755360,1102701600,735134400,698377680,551350800,490089600,367567200,294053760,245044800,220540320,183783600,147026880,122522400,110270160,86486400,73513440,64864800,61261200,43243200,36756720,32432400,28828800,21621600,17297280,14414400,12972960,10810800,8648640,7207200,6486480,5765760,4324320,3603600,3326400,2882880,2162160,1663200,1441440,1330560,1081080,997920,831600,720720,665280,554400,498960,443520,332640,277200,221760,166320,151200,110880,83160,75600,55440,50400,45360,40320,30240,27720,25200,20160,15120,10080,7560,5040,4320,3360,2520,2160,1680,1440,1260,1080,840,720,480,360,240,180,120,96,72,60,48,36,24,12,8,6,4,2,1}; ll B[N+5]={103680,98304,96768,92160,92160,86016,82944,82944,80640,73728,73728,73728,69120,69120,69120,65536,64512,64512,62208,61440,57600,55296,55296,53760,51840,49152,48384,46080,46080,43008,41472,40320,36864,36864,36864,34560,34560,34560,32768,32256,32256,30720,30720,28800,28800,28672,27648,27648,27648,26880,26880,25920,24576,24576,23040,23040,21504,21504,20736,20160,18432,18432,18432,17280,17280,16384,16128,16128,15360,14400,14400,14336,13824,13824,13824,13440,12960,12288,12288,11520,11520,10752,10752,10368,10080,9216,9216,9216,8640,8640,8192,8064,8064,7680,7200,7168,6912,6912,6720,6144,5760,5760,5376,5040,4800,4608,4608,4320,4096,4096,4032,4032,3840,3840,3600,3584,3584,3456,3456,3360,3072,2880,2688,2400,2304,2304,2304,2048,2016,2016,1920,1920,1920,1792,1728,1728,1680,1600,1536,1536,1440,1344,1280,1200,1152,1152,1024,1008,960,960,896,864,800,768,768,720,720,672,640,600,576,576,512,504,480,480,448,432,400,384,384,360,336,336,320,288,288,256,256,240,240,240,224,216,200,192,192,180,168,160,144,144,128,120,120,108,100,96,96,96,90,84,80,72,64,60,48,48,48,40,40,36,36,32,32,30,24,24,20,18,16,12,12,12,10,9,8,6,4,4,3,2,1}; int main(){ freopen("b.in","r",stdin);freopen("b.out","w",stdout); re int i;scanf("%d",&T);while(T--){ scanf("%lld",&n);for(i=0;i<=m;i++)if(n>=A[i]) {printf("%lld\n",B[i]);break;} } }