自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 zoj1610

Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at las...

2018-02-18 17:18:14 212

原创 HDU - 1698

In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now ...

2018-02-18 16:36:21 246

原创 HDU 1754

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=...

2018-02-18 16:00:45 243

原创 HDU 1166(简单单点更新)

C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术...

2018-02-18 15:47:12 155

原创 HDU 5950(矩阵快速幂)

Farmer John likes to play mathematics games with his N cows. Recently, they are attracted by recursive sequences. In each turn, the cows would stand in a line, while John writes two positive numbers a

2017-11-08 15:16:11 196

原创 HDU 5251 矩形面积 (计算几何+旋转卡壳求覆盖凸包的最小矩形面积)

小度熊有一个桌面,小度熊剪了很多矩形放在桌面上,小度熊想知道能把这些矩形包围起来的面积最小的矩形的面积是多少。Input 第一行一个正整数 T,代表测试数据组数(1≤T≤20),接下来 T 组测试数据。 每组测试数据占若干行,第一行一个正整数 N(1≤N≤1000),代表矩形的数量。接下来 N 行,每行 8 个整数x1,y1,x2,y2,x3,y3,x4,y4,代表

2017-09-13 17:54:06 645

原创 POJ 3384 Feng Shui (计算几何+半平面交)

Feng shui is the ancient Chinese practice of placement and arrangement of space to achieve harmony with the environment. George has recently got interested in it, and now wants to apply it to his home

2017-09-13 14:46:26 312

原创 POJ 1755 Triathlon (计算几何+半平面交解决线性规划)

Triathlon is an athletic contest consisting of three consecutive sections that should be completed as fast as possible as a whole. The first section is swimming, the second section is riding bicycle a

2017-09-13 14:25:49 541

原创 POJ 1279 Art Gallery (计算几何+半平面交)

The art galleries of the new and very futuristic building of the Center for Balkan Cooperation have the form of polygons (not necessarily convex). When a big exhibition is organized, watching over all

2017-09-12 16:00:29 408

原创 POJ 3130 How I Mathematician Wonder What You Are! (计算几何+半平面交)

After counting so many stars in the sky in his childhood, Isaac, now an astronomer and a mathematician uses a big astronomical telescope and lets his image processing program count stars. The hardest

2017-09-12 15:40:32 276

原创 POJ 3335 (计算几何+半平面交)

This year, ACM/ICPC World finals will be held in a hall in form of a simple polygon. The coaches and spectators are seated along the edges of the polygon. We want to place a rotating scoreboard somewh

2017-09-12 13:35:16 293

原创 HDU 6128(乱搞)

Problem DescriptionThere are n nonnegative integers a1…n which are less than p. HazelFan wants to know how many pairs i,j(1≤ij≤n) are there, satisfying 1ai+aj≡1ai+1aj when we calculate mod

2017-09-07 20:46:36 318

原创 HDU 6129(找规律+杨辉三角)

Problem DescriptionThere is a nonnegative integer sequence a1...n of length n. HazelFan wants to do a type of transformation called prefix-XOR, which means a1...n changes into b1...n, wh

2017-09-07 17:02:50 276

原创 HDU 6156(数位DP+乱搞)

Problem DescriptionAs we all know,a palindrome number is the number which reads the same backward as forward,such as 666 or 747.Some numbers are not the palindrome numbers in decimal form,but in oth

2017-09-07 14:57:50 326

原创 HDU 6158 (计算几何+笛卡尔定理+韦达定理)

Problem DescriptionNowadays, little haha got a problem from his teacher.His teacher wants to design a big logo for the campus with some circles tangent with each other. And now, here comes the pro

2017-09-07 10:57:24 491

原创 HDU 6169(数论+DP)

Problem DescriptionSenior Pan had just failed in his math exam, and he can only prepare to make up for it. So he began a daily task with Master Dong, Dong will give a simple math problem to poor

2017-09-07 09:36:18 355

原创 BZOJ 1833 count 数字计数 (数位DP)

给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次。Input 输入文件中仅包含一行两个整数a、b,含义如上所述。 Output 输出文件中包含一行10个整数,分别表示0-9在[a,b]中出现了多少次。 Sample Input 1 99Sample Output 9 20 20 20 20 20 20 20 20 20Hint 3

2017-08-04 15:42:32 252

原创 BZOJ 1799 self 同类分布 (数位dp)

Description给出a,b,求出[a,b]中各位数字之和能整除原数的数的个数。Sample Input 10 19Sample Output 3Hint 【约束条件】1 ≤ a ≤ b ≤ 10^18这个题因为在搜索的过程中数位的数字和一直在变,导致mod也在变。所以我们要遍历并固定mod,找出对于每一个mod,使得各位数字和刚好等于

2017-08-04 15:30:07 218

原创 BZOJ 3930 选数 (莫比乌斯反演+神奇的杜教筛)

(对于100%的数据,1≤N,K≤10^9,1≤L≤H≤10^9,H-L≤10^5)这个题要是数据范围出小一些解释个裸的莫比乌斯反演。问题就是数据范围太鬼畜,我们无法筛出这个范围的莫比乌斯函数前缀和。这时就要用到杜教筛,它是用来解决 n本鶸对此理解还不深,大家可以自行上网找相关博客。这一篇就很好author: skywalkert original articl

2017-08-04 14:55:05 382

原创 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 225

原创 零碎知识点

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 163

原创 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 533

原创 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 236

原创 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 356

原创 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 278

原创 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 237

原创 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 232

原创 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 269

原创 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 228

原创 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 620

原创 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 363

原创 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 271

原创 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 480

原创 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 260

原创 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 376

原创 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 299

原创 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 702

原创 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 523

原创 UVA 7040

大意:有一排一共n个珠子,要用m种颜色中的恰好k种去涂色,相邻的两个颜色要不同,问方案数。做法大概就是C(m,k)表示m中k种颜色,然后对于每k个颜色进行容斥(大概就是这样)代码:#include #include #include #include #include #include #include #include #include #include #inc

2017-05-16 12:32:16 280

原创 Codeforces 547C - Mike and Foam (容斥)

在这个题用容斥做的过程中从别人的博客学到了一些有趣的处理方法(好吧,其实是我太菜了,那种方法我之前没见过)。。。。。。思路:先预处理出每个数的质因子然后对于每一个操作数算出与它互质的数的个数再加加减减。。。。。。详见代码,可能有说不清楚或者搞错的地方,望指正#include #include #include #include #include #include #includ

2017-05-01 13:55:41 213

空空如也

空空如也

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

TA关注的人

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