[ BSGS ] BZOJ3239
来源:互联网 发布:爱淘宝买东西如何返利 编辑:程序博客网 时间:2024/06/15 17:23
裸题
#include<bits/stdc++.h>using namespace std;map<int,int>M;int b,n,p,s,S,t,tmp,T;bool f;int main(){ while(scanf("%d%d%d",&p,&b,&n)!=EOF){ s=ceil(sqrt(p)); M.clear();t=n; for(int i=0;i<=s;i++,t=1ll*t*b%p)M[t]=i; t=1; for(int i=0;i<s;i++)t=1ll*t*b%p; f=0; for(int i=1,j=t;i<=s;i++,j=1ll*j*t%p) if(M.count(j)){ printf("%d\n",i*s-M[j]); f=1; break; } if(!f)printf("no solution\n"); } return 0;}
阅读全文
1 0
- [ BSGS ] BZOJ3239
- 【bzoj3239】Discrete Logging BSGS
- [BZOJ3239][BSGS]Discrete Logging
- [BZOJ3239][poj2417]Discrete Logging(BSGS算法)
- Bzoj3239:Discrete Logging:BSGS模板题
- poj2417 bzoj3239 Discrete Logging(bsgs)
- BSGS
- 【bzoj3239】 Discrete Logging
- BSGS及扩展BSGS
- BSGS&扩展BSGS
- 【bsgs】hdu4887
- BZOJ2242【BSGS】
- bsgs算法
- bzoj3122(bsgs)
- 【Bsgs】【ExBsgs】
- bsgs算法
- 模板 BSGS
- [ BSGS ] BZOJ2242
- 关于ViewDragHelper动态addview的问题
- Mac:TexStudio environ not found
- 百度富文本图片上传路径配置(非项目路径)
- soket相关
- QT下添加字库支持
- [ BSGS ] BZOJ3239
- Caffe入门学习(7)将自己的图像数据转成lmdb格式
- JS实现用户上传图片并预览(图片fakepath问题)
- js(三)---函数的作用域与闭包
- Android多线程--Android中常见的四种线程池
- c语言中的结构体
- 跨时钟域处理
- SQL黑客注入防御与绕过的多种姿势
- java配置定时任务