
数论
不楸
现在的自己对的起以后
展开
-
ACM-ICPC 2018 南京赛区网络预赛-J Sum(线性筛选+因数分解)
A square-free integer is an integer which is indivisible by any square number except 11. For example, 6 = 2 \cdot 36=2⋅3 is square-free, but 12 = 2^2 \cdot 312=22⋅3 is not, because 2^222 is a square n...原创 2018-09-02 15:38:57 · 378 阅读 · 0 评论 -
Wannafly24-b(扩展欧几里得算法)
链接:https://www.nowcoder.com/acm/contest/186/B来源:牛客网 题目描述小Y最近对质数产生了浓厚的兴趣,他认为2和3与其它所有质数具有不同寻常的关联,他正试图去寻找这些关系。可以知道,对于任意质数P>=5,都存在正整数m,n使得P|(2m)*(3n)-1,且m+n<=P。但小Y想知道对于一个质数P,满足上述条件的数对(m,n)中m+n...原创 2018-09-20 20:23:20 · 324 阅读 · 0 评论 -
欧几里得定理+线性同余+逆元
欧几里得定理:gcd(a,b) = gcd(b,a mod b)证明: a可以表示成a = kb + r,则r = a mod b 1.假设d是a,b的一个公约数,则有 a|d, b|d,而r = a - kb,因此r|d 因此d是(b,a mod b)的公约数,证明充分性 2.假设d 是(b,a mod b)的公约数,则 :b|d , r|d ,但是a = kb...原创 2018-09-14 22:53:13 · 399 阅读 · 0 评论 -
HDU5114(扩展欧几里得定理)
数学(扩展欧几里得算法):HDU 5114 CollisionMatt is playing a naive computer game with his deeply loved pure girl.The playground is a rectangle with walls around. Two balls are put in different positions inside...原创 2018-09-14 22:13:06 · 401 阅读 · 0 评论 -
LightOJ1109(因数分解+打表)
We define b is a Divisor of a number a if a is divisible by b. So, the divisors of 12 are 1, 2, 3, 4, 6, 12. So, 12 has 6 divisors.Now you have to order all the integers from 1 to 1000. x will come ...原创 2018-09-12 22:25:14 · 316 阅读 · 0 评论 -
LightOJ1024(LCM+高精度乘法)
In a strange planet there are n races. They are completely different as well as their food habits. Each race has a food-eating period. That means the ith race eats after every xi de-sec (de-sec is the...原创 2018-09-12 20:27:28 · 290 阅读 · 0 评论 -
欧拉函数及相关定理
欧拉函数定义:小于或等于n且与n互质的数的个数 互质条件:gcd(a,b)=1;φ(n)=n*(1-1/p1)*(1-1/p2)*...*(1-1/px) 其中:p1,p2..px 为n的质因数;例: φ(8)={1,3,5,7}=4=8*(1-1/2); φ(7)={1,2,3,4,5,6}=6=7*(1-1/7);欧拉函数的性质:(1...原创 2018-09-06 22:14:37 · 525 阅读 · 0 评论 -
FZU1752(快速幂+快速乘法)
Problem 1752 A^B mod C Accept: 1126 Submit: 5065Time Limit: 1000 mSec Memory Limit : 32768 KB Problem DescriptionGiven A,B,C, You should quickly calculate the result of A^B mod C. (1<=...原创 2018-09-06 21:15:55 · 223 阅读 · 0 评论 -
ACM-ICPC 2018 焦作赛区网络预赛 -I Give Candies(扩展欧拉定理+大数取模)
There are NN children in kindergarten. Miss Li bought them NN candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their student number ...原创 2018-09-16 11:08:02 · 237 阅读 · 0 评论 -
HDU6440 费马小定理
DreamTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1135 Accepted Submission(s): 294Special Judge Problem DescriptionFreshmen frequ...原创 2018-08-27 11:23:16 · 270 阅读 · 0 评论 -
LightOJ 1007(欧拉函数打表+前缀和)
Mathematically some problems look hard. But with the help of the computer, some problems can be easily solvable.In this problem, you will be given two integers a and b. You have to find the summatio...原创 2018-09-03 18:18:42 · 303 阅读 · 0 评论 -
CSU1803 (简单同余定理)
Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量: 1. 1≤a≤n,1≤b≤m; 2. a×b 是 2016 的倍数。Input 输入包含不超过 30 组数据。 每组数据包含两个整数 n,m (1≤n,m≤109).Output对于每组数据,输出一个整数表...原创 2018-09-11 20:57:45 · 165 阅读 · 0 评论 -
POJ1061(扩展欧几里得+同余算法)
青蛙的约会Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 129229 Accepted: 28286 Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前...原创 2018-09-11 19:35:22 · 222 阅读 · 0 评论 -
南桥杯算法训练-素因子去重
问题描述 给定一个正整数n,求一个正整数p,满足p仅包含n的所有素因子,且每个素因子的次数不大于1输入格式 一个整数,表示n输出格式 输出一行,包含一个整数p。样例输入1000样例输出10数据规模和约定 n<=10^12 样例解释:n=1000=2^3*5*3,p=2*5=10 题解:直接求素因子然后累乘,注意最后判断剩下的是否...原创 2019-01-29 23:03:18 · 351 阅读 · 0 评论