数论
Yuer-
pku.
展开
-
数论
欧拉函数Phi(x)等于不超过原创 2014-11-03 18:45:31 · 448 阅读 · 0 评论 -
zoj 3729 2013长沙regional 求斐波那契数列模n循环节长度
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5075ArnoldTime Limit: 8 Seconds Memory Limit: 65536 KBDo you know Vladimir Arnold? He's a mathematician who demonstrat原创 2015-09-29 21:25:14 · 1130 阅读 · 0 评论 -
各种gcd
1. 求∑gcd(i, N) 1k=gcd(i,n) , gcd(i/k,n/k)=1 ans=∑k*phi(n/k)[poj2480]2.求LCM(a,b,c,d,e,.......)依次分解质因数,保留最大次项3.求LCM(∑C(n,k)) (1hdu 5407ans的因子:小于等于n+1的质数p,以及p的多次幂 最后原创 2015-08-21 11:30:10 · 582 阅读 · 0 评论 -
CF 551DGukiZ and Binary Operations 矩阵/位运算
D. GukiZ and Binary Operationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe all know原创 2015-07-05 22:41:57 · 638 阅读 · 0 评论 -
【扩展欧几里得】练习题
1 .poj 1061青蛙的约会 最基础的一道 http://poj.org/problem?id=1061 题意:有两只青蛙,一只在坐标x,另一直在坐标y,青蛙x一次跳跃可以前进m单位距离,青蛙y一次跳跃可以前进n单位的距离,两青蛙都在同一纬度,该纬度长度为L。两只青蛙同方向同时跳啊跳,问你最少跳多少次,它们才可以相遇,如果不能相遇,输出impossble#include<cstdio>#原创 2015-05-13 20:25:39 · 1341 阅读 · 0 评论 -
codeforces/#305 Div1/547/C Mike and Foam 【容斥】
C. Mike and Foamtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike is a bartender at Rico's bar. At Rico原创 2015-06-06 20:19:39 · 647 阅读 · 0 评论 -
hdu 5072 容斥
CoprimeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1123 Accepted Submission(s): 453Problem DescriptionThere are n people st原创 2015-06-06 12:35:09 · 434 阅读 · 0 评论 -
高效位运算 __builtin_系列函数
•int __builtin_ffs (unsigned int x) 返回x的最后一位1的是从后向前第几位,比如7368(1110011001000)返回4。 •int __builtin_clz (unsigned int x) 返回前导的0的个数。 •int __builtin_ctz (unsigned int x) 返回后面的0个个数,和__builtin_clz相对。 •in原创 2015-06-06 00:12:56 · 19492 阅读 · 0 评论 -
一元线性同余方程组【数论
http://poj.org/problem?id=2891 数论P56#include "cstdio"#include <iostream>#include <cstring>#include <cmath>using namespace std;#define ll long longll exgcd(ll a,ll b,ll &x, ll & y){ if(b==0){原创 2015-05-19 11:35:01 · 769 阅读 · 0 评论 -
大数a*b%m a^b%m
ll motil(ll a, ll b , ll m) //a*b%m{ ll ans=1; while(b){ if(b&1){ ans=(ans+a)%m; } b>>=1; a=(a<<1)%m; } return ans;}ll motil_pow(ll a, ll b , ll m)//a^b %m{ ll ans=1;原创 2015-05-22 10:47:50 · 1283 阅读 · 0 评论 -
LCM lightoj1215
Problem: http://lightoj.com/volume_showproblem.php?problem=1215 LCM(a,b,c)=L give you a , b and L, please find the minmum c.solve: m=lcm(a,b), then lcm(m,c) is L m分解为p1^e1 * p2^e2 * p3^e3….. c分解原创 2015-05-28 14:52:22 · 532 阅读 · 0 评论 -
扩展欧几里得【数论
如果gcd(m,n)==1那么一定存在原创 2014-08-18 12:34:28 · 487 阅读 · 0 评论 -
DLUTOJ 1330 GCD 【莫比乌斯反演+组合】
http://acm.dlut.edu.cn/problem.php?id=13301330: GCDTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 22 Solved: 6[Submit][Status][Web Board]DescriptionHow many non decreasing s原创 2015-10-05 20:14:34 · 537 阅读 · 0 评论