自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

原创 HDU 4565 so easy ! 矩阵快速幂

SO EASY 不是说题目 so easy,是说题目名字叫 so easy。。。。。这个题可以这样想:直接用 double 求结果肯定是不行的(精度不够啥的),因为题目要求的是整数部分,可以考虑把有理数拆一下设 (a+sqrt(b))^ n = Xn + Yn*sqrt(b) , 那么 (a + sqrt(b) )^ (n+1) = Xn*a+Yn*b+ ( Xn + Yn*a )*sqr

2017-07-24 11:18:23 238

原创 零碎知识点

d(ij)表示 i*j 的约数的个数,[ n/i ] [ m/j ] 向下取整,[ gcd(i,j)==1 ]返回式子 gcd(i,j)==1 的 bool 值 (题目:BZOJ 3994)

2017-07-17 20:30:32 180

原创 HDU - 4675(莫比乌斯反演)

Alice is playing a game with Bob. Alice shows N integers a 1, a 2, …, a N, and M, K. She says each integers 1 ≤ ai ≤ M. And now Alice wants to ask for each d = 1 to M, how many different sequenc

2017-07-17 15:32:55 564

原创 HDU - 4746 (莫比乌斯反演)

As we know, any positive integer C ( C >= 2 ) can be written as the multiply of some prime numbers:    C = p1×p2× p3× ... × pk which p1, p2 ... pk are all prime numbers.For example, if C = 24, t

2017-07-17 13:54:27 246

原创 SPOJ - VLATTICE Visible Lattice Points (莫比乌斯反演)

Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are visible from corner at (0,0,0) ? A point X is visible from point Y iff no other latti

2017-07-17 10:56:25 367

原创 UVA - 10655 (矩阵快速幂)

这个题我一开始非要怼着 (a+b)^n不放推了老半天然并卵。。。。。。可以酱紫:(a^n+b^n)*(a+b)=a^(n+1)+b^(n+1)+a*b^n+b*a^n得到:f(n+1)=f(n)*(a+b)-f(n-1)*a*b 然后矩阵快速幂(怀疑人生中。。。。。。)(我矩阵快速幂写的比较丑不要介意。。。)#include #include #include #in

2017-07-17 10:46:14 298

原创 UVA - 11426

可以转化成求n以内gcd为1的,gcd为2的………gcd为n-1的i,j(i<j≤n)的对数,然后对数乘以相应的gcd即可然后gcd为k的i,j的对数为m=n/k以内的i,j互质的对数,即2以内与2互质的数的数目+3以内与3互质的数的数目+……+m以内与m互质的数的数目即欧拉函数值之和要注意的是 i 要小于 j ,即 i!=j ,所以要先令phi【1】=0再求和#include

2017-07-10 08:33:29 276

原创 LightOJ - 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 knowN! = 1*2*...*N. For example, 5! = 120, 120 contains one zero on the tr

2017-07-09 20:58:22 265

原创 LightOJ - 1220(n=b^k时最大的k,GCD)

Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactlyx days. Now RC-01 produces exactly p new deadly Bacteria wherex

2017-07-09 20:43:25 280

原创 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 exactlyx days. Now RC-01 produces exactlyp new deadly Bacteria wherex = b

2017-07-09 20:30:14 265

原创 LightOJ - 1234 (介绍一下欧拉常数,虽然没什么关系。。。)

In mathematics, the nth harmonic number is the sum of the reciprocals of the firstn natural numbers:In this problem, you are given n, you have to find Hn.Input Input starts with an integ

2017-07-09 19:47:26 641

原创 LightOJ - 1236质因子分解+LCM

Find the result of the following code:long long pairsFormLCM( int n ) {    long long res = 0;    for( int i = 1; i  n; i++ )        for( int j = i; j  n; j++ )           if( lcm(i, j) ==

2017-07-09 19:27:57 393

原创 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;    r

2017-07-09 19:17:31 286

原创 LightOJ - 1282(n^k的前三位数字和后三位数字)

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.Input    Input starts with an integer T (≤ 1000), denoti

2017-07-09 10:02:00 496

原创 LightOJ - 1341 合数分解

It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magi

2017-07-09 09:30:20 271

原创 LightOJ - 1336 Sigma Function (n以内约数和为奇数(偶数)的数的个数)

Sigma 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 σ(24) = 1+2+3+4

2017-07-06 09:20:06 415

原创 codeforces 296B - Yaroslav and Two Strings (DP+容斥)

B. Yaroslav and Two StringsYaroslav thinks that two strings s and w, consisting of digits and having length n are non-comparable if there are two numbers, i and j (1 ≤ i, j ≤ n), such

2017-07-04 21:35:33 323

原创 n的约数和

n=p1^e1*p2^e2*...*pn^en (pi为素数,ei为素数因子的个数)则:n的约数的个数: (e1+1)*(e2+1)*....*(en+1);n的约数和: (1+p1^1+...+p1^e1)*(1+p2^1+...+p2^e2)*...*(1+pn^1+...+pn^en);括号里的东西就用等比数列求和我就。。。随便写写。。。

2017-07-04 19:42:11 717

原创 LightOJ - 1356

素数+二分图二分图我不会暂时就不给代码了A set of integers is called prime independent if none of its member is a prime multiple of another member. An integera is said to be a prime multiple of b if,a = b x k

2017-07-04 09:12:37 555

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除