日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

BJFU fudq的等式

發布時間:2025/4/14 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 BJFU fudq的等式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 /* 2 BJFU fudq的等式 3 http://101.200.220.237/contest/19/problem/118/ 4 數論 勒讓德定理 二分答案 5 */ 6 #include <cstdio> 7 #include <algorithm> 8 #include <cstring> 9 #include <cmath> 10 #include <vector> 11 #include <queue> 12 //#define test 13 using namespace std; 14 const int Nmax=1000005; 15 const long long INF=100000000000005LL; 16 long long p[Nmax]; 17 long long times[Nmax]; 18 int cnt; 19 long long n,x,y; 20 21 long long Legendre(long long n,long long p,long long y) 22 { 23 long long ans=0LL; 24 while(n>0) 25 { 26 ans+=n/p; 27 if(ans>y) 28 return y+1LL; 29 n/=p; 30 } 31 return ans; 32 } 33 34 int is(long long n) 35 { 36 for(int i=1;i<=cnt;i++) 37 { 38 if(Legendre(n,p[i],times[i]*y)<times[i]*y) 39 return 0; 40 } 41 return 1; 42 } 43 long long get() 44 { 45 long long n=0LL; 46 long long l=1LL,r=INF; 47 while(l<r) 48 { 49 long long mid=(l+r)>>1; 50 long long m=is(mid); 51 //printf("l:%lld r:%lld mid:%lld x:%lld y:%lld num:%lld\n",l,r,mid,x,y,m); 52 if(!m) 53 l=mid+1; 54 else 55 r=mid-1; 56 } 57 if(n==0LL && !is(r)) 58 n=r+1; 59 else if(n==0LL && is(r)) 60 n=r; 61 return n; 62 63 } 64 //long long get() 65 //{ 66 //long long m=-1LL; 67 //for(int i=1;i<=cnt;i++) 68 //{ 69 //m=max(m,get(p[i],times[i]*y)); 70 //} 71 //return m; 72 //} 73 int main() 74 { 75 #ifdef test 76 #endif 77 //freopen("test.in","r",stdin); 78 while(scanf("%lld%lld",&x,&y)==2) 79 { 80 cnt=0; 81 for(int i=2;i*i<=x;i++) 82 { 83 if(x%i==0) 84 { 85 p[++cnt]=i; 86 times[cnt]=0; 87 while(x%i==0) 88 { 89 x/=i; 90 times[cnt]++; 91 } 92 } 93 } 94 if(x!=1) 95 { 96 p[++cnt]=x; 97 times[cnt]=1; 98 } 99 100 if(cnt==0) 101 { 102 //printf("error\n"); 103 printf("0\n"); 104 continue; 105 } 106 printf("%lld\n",get()); 107 } 108 return 0; 109 }

?

轉載于:https://www.cnblogs.com/BBBob/p/6636359.html

總結

以上是生活随笔為你收集整理的BJFU fudq的等式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。