Discrete Logging(POJ2417 + BSGS)】的更多相关文章

题目链接:http://poj.org/problem?id=2417 题目: 题意: 求一个最小的x满足a^x==b(mod p),p为质数. 思路: BSGS板子题,推荐一篇好的BSGS和扩展BSGS的讲解博客:http://blog.miskcoo.com/2015/05/discrete-logarithm-problem 代码实现如下: #include <set> #include <map> #include <queue> #include <st…
Discrete Logging Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 5577   Accepted: 2494 Description Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, b…
Discrete Logging Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 5120   Accepted: 2319 Description Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, b…
<题目链接> 题目大意: P是素数,然后分别给你P,B,N三个数,然你求出满足这个式子的L的最小值 : BL== N (mod P). 解题分析: 这题是bsgs算法的模板题. #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <string> #include <math.h> #include…
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3239 [题目大意] 计算满足 Y^x ≡ Z ( mod P) 的最小非负整数 [题解] BSGS裸题. [代码] #include <cstdio> #include <cmath> #include <map> #include <algorithm> #include <tr1/unordered_map> using name…
3239: Discrete Logging Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 729  Solved: 485[Submit][Status][Discuss] Description Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 2 <= N < P, compute the discrete logar…
POJ 2417 Discrete Logging Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4860   Accepted: 2211 Description Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarith…
[BZOJ3239]Discrete Logging Description Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 2 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an integer L such that BL== N (mod P) Inpu…
我先转为敬? orz% miskcoo 贴板子 BZOJ 3239: Discrete Logging//2480: Spoj3105 Mod(两道题输入不同,我这里只贴了3239的代码) CODE #include<bits/stdc++.h> using namespace std; typedef long long LL; int p, a, b; int gcd(int a, int b) { return b ? gcd(b, a%b) : a; } inline int qpow…
Discrete Logging Given a prime P, 2 <= P < 2 31, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an integer L such that B L == N (mod P) Input Read several line…