
数论
小郑¥
这个作者很懒,什么都没留下…
展开
-
Channel Allocation POJ - 1129 + 染色定理
问题:When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each repeater mu...原创 2019-07-28 21:01:33 · 377 阅读 · 0 评论 -
中国剩余定理
一个整数除以3余2,除以5余3,除以7余2,求这个整数。除以3余2和除以7余2的数可以写成21n+2。21n+2除以5余3,要求21n除以5余1。21n除以5余1,21除以5余1,要求n除以5余1(乘数之余等于余数之乘),则n最小取1。所以满足“除以3余2,除以5余3,除以7余2”的最小的数是21×1+2=23。标准解法:先从3和5、3和7、5和7的公倍数中相应地找出分别被7、5、3除均余1的较小数15、21、70 ( 注释:此步又称为求"模逆"运算,利用扩展欧几里得法并借助计算机编程可比较快速地原创 2021-06-15 21:19:38 · 419 阅读 · 0 评论 -
#10199. 「一本通 6.2 练习 2」轻拍牛头 用唯一分解定理求因子值
题目:今天是贝茜的生日,为了庆祝自己的生日,贝茜邀你来玩一个游戏。贝茜让 N 头奶牛坐成一个圈。除了 1 号与 N号奶牛外,i号奶牛与 i − 1 号和 i + 1号奶牛相邻,N 号奶牛与 1 号奶牛相邻。农夫约翰用很多纸条装满了一个桶,每一张包含了一个 1 到 10^6的数字。接着每一头奶牛 i 从桶中取出一张纸条 Ai,每头奶牛轮流走一圈,同时拍打所有编号能整除在纸条上的数字的牛的头,然后走回到原来的位置。奶牛们想让你帮他们计算,对于每头奶牛,它需要拍多少头奶牛的头?输入格式第一行包含...原创 2021-05-11 09:39:16 · 557 阅读 · 0 评论 -
Sigma Function LightOJ - 1336 数论经典推理
题目:Sigma function is an interesting function in Number Theory. It is denoted by the Greek letterSigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4+6+8+12+24=60. Sigma of small numbers is easy to fi.原创 2021-05-05 10:55:03 · 300 阅读 · 0 评论 -
欧拉降幂
欧拉函数:欧拉函数是小于或等于n的正整数中与n互质的数的数目(因此φ(1)=1)求一个数的欧拉值为:欧拉降幂公式:原创 2020-10-06 21:49:57 · 409 阅读 · 2 评论 -
LCM from 1 to n LightOJ - 1289 节省时间的素数筛
问题:Given an integern, you have to findlcm(1, 2, 3, ..., n)lcmmeans least common multiple. For example lcm(2, 5, 4) = 20, lcm(3, 9) = 9, lcm(6, 8, 12) = 24.InputInput starts with an integerT (≤ 10000), denoting the number of test cases.Each c...原创 2020-05-12 10:57:27 · 270 阅读 · 0 评论 -
The Football Season CodeForces - 1244C 扩展欧几里得
问题:The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one o...原创 2019-10-18 21:14:40 · 298 阅读 · 0 评论 -
GCD and LCM HDU - 4497 排列组合
问题:Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and lcm(x, y, z) = L?Note, gcd(x, y, z) means the greatest com...原创 2019-08-13 10:57:49 · 221 阅读 · 0 评论 -
GCD - Extreme (II) UVA - 11426 欧拉筛
问题:Given the value of N, you will have to find the value of G. The definition of G is given below: Here GCD(i, j) means the greatest com...原创 2019-08-12 19:50:11 · 169 阅读 · 0 评论 -
青蛙的约会 POJ - 1061 扩展欧几里得算法
问题:两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐...原创 2019-08-12 19:36:06 · 240 阅读 · 0 评论 -
网络流模板
#include<stdio.h>#include<string.h>#include<math.h>#include<cmath>#include<cstdio>#include<cstring>#define N 10005#define X 1000000#define mem(a) memset(a,...原创 2019-08-19 21:39:37 · 154 阅读 · 0 评论 -
Beijing 2008 HDU - 1852 不互质求逆元
问题:As we all know, the next Olympic Games will be held in Beijing in 2008. So the year 2008 seems a little special somehow. You are looking forward to it, too, aren't you? Unfortunately there still ...原创 2019-08-13 21:33:41 · 1118 阅读 · 0 评论 -
Harmonic Number LightOJ - 1234 调和级数
问题:In mathematics, thenthharmonic number is the sum of the reciprocals of the firstnnatural numbers: ...原创 2019-08-09 11:18:15 · 246 阅读 · 0 评论 -
Mysterious Bacteria LightOJ - 1220 唯一分解定理
问题:Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactlyxdays. Now RC-01 produces exactlypnew deadly Bacteria where...原创 2019-08-09 10:43:00 · 191 阅读 · 0 评论 -
Help Hanzo LightOJ - 1197 区间素数筛
问题:Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Hanzo Hattori, the best ninja and the love of Nakururu. Aft...原创 2019-08-09 10:30:09 · 313 阅读 · 0 评论 -
Happy 2004 HDU - 1452 积性函数+逆元+快速幂
问题:Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the rest of the division of S by 29).Take X = 1 for an examp...原创 2019-08-13 20:11:54 · 195 阅读 · 0 评论 -
Leading and Trailing LightOJ - 1282 快速幂
问题:You are given two integers:nandk, your task is to find the most significant three digits, and least significant three digits ofnk.InputInput starts with an integerT (≤ 1000), denoting th...原创 2019-08-09 10:02:33 · 350 阅读 · 0 评论