首页 > 猫猫与数学
头像 AliLexiWalker
发表于 2026-04-29 00:11:38
思路:让 和 有共同质因子;任何共同质因子必整除 ,所以枚举 的质因子 ,取最小的 使 。 证明:若 且 ,则 ,所以这样的 必为 的因子;反之取 并令 即可使 同时整除 和 ,若 则无解。 import sys data=sys.stdin.read().split() i 展开全文
头像 此在Dasein
发表于 2026-04-29 04:19:06
数论分解与线性同余 1. 问题分析 我们要寻找最小的 ,使得存在某一个 满足 且 。 由于任何合数 都可以表示为质数的乘积,如果 能够被 的某个合数约数整除,那它也必然能被该约数的质因子整除。因此,我们只需要考察 的所有质因子。 2. 特殊情况处理 在应用核心算法前,需根据 的取值进行 展开全文
头像 飞鸢泛惊鸿
发表于 2026-04-29 22:07:19
from math import gcd a, b = map(int, input().split()) inf = float("inf") if gcd(a, b) > 1: print(0) elif a & 1 and b & 1: 展开全文
头像 Eclat_W
发表于 2026-04-29 21:14:56
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 1e6 + 5; vector<ll> get(ll n) 展开全文
头像 quchen666
发表于 2026-04-29 13:22:52
#include <bits/stdc++.h> #include <cstdio> using namespace std; typedef long long ll; const ll INF = 1e18; int main() { ll a,b; 展开全文
头像 IA3000
发表于 2026-04-29 23:14:11
#include <iostream> using namespace std; using LL = long long; void solve() { LL a, b; cin >> a >> b; LL c = abs(a - b) 展开全文
头像 W_L_J_Y
发表于 2026-04-30 00:16:48
题目AC 代码 #include <iostream> #include <cmath> #include <vector> #include <algorithm> #define ll long long using namespace std; 展开全文

等你来战

查看全部