数论
文章平均质量分 55
D-DeepWave
这个作者很懒,什么都没留下…
展开
-
D - Sigma Function LightOJ - 1336
链接lightoj1336Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(...原创 2018-06-09 17:30:45 · 231 阅读 · 0 评论 -
HDU6395 多校赛Sequence
传送门----http://acm.hdu.edu.cn/showproblem.php?pid=6395 思路:由于有后半部分的下取整,可以联想到整除分块去做。再用矩阵快速幂优化递推即可。 Code: //2 #include<iostream> #include<cstdio> #include<cmath> #include<cstrin...原创 2018-08-14 09:56:32 · 237 阅读 · 0 评论 -
Z - The Super Powers
题目链接https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2852 思路:由可被两个幂次表示知,指数必定为合数,而64以内的合数很好确定,最小的指数必定为4 故直接找最大不超过1<<16即可。 用set排序,需注...原创 2018-07-21 10:27:07 · 613 阅读 · 0 评论 -
N - Trailing Zeroes (III) Lightoj 1138
题目链接http://lightoj.com/volume_showproblem.php?problem=1138 You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*.....原创 2018-07-20 19:28:35 · 308 阅读 · 0 评论 -
O - GCD - Extreme (II)
题目链接https://vjudge.net/contest/233487#problem/O 思路:将GCD(n,x)为一个值得分类整理计算。 易知G[n]=G[n-1]+gcd(1,n)+gcd(2,n)+....gcd(n-1,n) 令gcd(1,n)+gcd(2,n)+....gcd(n-1,n)=A(n),对A(n)而言gcd(x,n) 1<=x<=n 若其值为d,则...原创 2018-07-20 14:55:57 · 317 阅读 · 0 评论 -
第九届福建省大学生程序设计竞赛 J题Mind control(FZOJ 2303 )
链接---点击打开链接 测试: Code: #include<cstdio> #include<algorithm> using namespace std; const long long mod=1000000007; long long exgcd(long long a,long long b,long long& x,long l...原创 2018-06-20 11:12:25 · 716 阅读 · 0 评论 -
I - Harmonic Number LightOJ - 1234
链接点击打开链接In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers:In this problem, you are given n, you have to find Hn.InputInput starts with an integer T (...原创 2018-06-10 17:13:37 · 280 阅读 · 0 评论 -
K - Large Division LightOJ - 1214
链接:点击打开链接Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a =...原创 2018-06-10 15:47:17 · 185 阅读 · 0 评论 -
R - 青蛙的约会 POJ - 1061
链接:点击打开链接两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助...原创 2018-06-10 15:22:03 · 228 阅读 · 0 评论 -
G - Harmonic Number (II) LightOJ - 1245
链接:点击打开链接 I was trying to solve problem '1234 - Harmonic Number', I wrote the following codelong long H( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) res = res + n / i; ...原创 2018-06-10 14:04:30 · 273 阅读 · 0 评论 -
E - Leading and Trailing LightOJ - 1282
题目链接点击打开链接You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.InputInput starts with an integer T (≤ 1000), denoting t...原创 2018-06-09 21:22:58 · 224 阅读 · 0 评论 -
HDU 6333 Problem B. Harvest of Apples 莫队算法
传送门 ----------------链接 题意:求C(n,0)+C(n,1)+C(n,2)+....C(n,m) 注意到题目的n和m都很大,并且有1e5组数据,暴力一定会超时。一开始想的是C(n,0)+C(n,1)+C(n,2)+....C(n,m)能否化简为 一个组合数表达式,在化简过程中发现了如下规律。 于是可以将每次询问看作区间,可...原创 2018-08-02 12:29:24 · 169 阅读 · 0 评论