- 博客(31)
- 收藏
- 关注
原创 hdu5525Product+约数的乘积
Product Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1003 Accepted Submission(s): 231Problem Description Given a number sequence A1,A
2016-09-30 00:19:44 605
原创 cf615Multipliers+N的约数的乘积
DescriptionAyrat has number n, represented as it’s prime factorization pi of size m, i.e. n = p1·p2·…·pm. Ayrat got secret information that that the product of all divisors of n taken modulo 109 + 7 is
2016-09-30 00:15:22 577
原创 BZOJ 2818: 欧拉筛法求gcd(x,y)==k(k为质数)
Description给定整数N,求1<=x,y<=N且Gcd(x,y)为素数的 数对(x,y)有多少对.Input一个整数NOutput如题Sample Input4Sample Output4Hinthint对于样例(2,2),(2,4),(3,3),(4,2)1<=N<=10^7GCD(px,py)==p; 有GCD(x,y)==1,在1-n/p的情况数。即1-n/p的欧拉和。p为质数。
2016-09-29 21:19:00 1663
原创 codeforces574C数论
DescriptionLimak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table
2016-09-29 17:55:20 435 1
原创 SYSBZ3930选数+区间中gcd==k的个数
Description我们知道,从区间[L,H](L和H为整数)中选取N个整数,总共有(H-L+1)^N种方案。小z很好奇这样选出的数的最大公约数的规律,他决定对每种方案选出的N个整数都求一次最大公约数,以便进一步研究。然而他很快发现工作量太大了,于是向你寻求帮助。你的任务很简单,小z会告诉你一个整数K,你需要回答他最大公约数刚好为K的选取方案有多少个。由于方案数较大,你只需要输出其除以100000
2016-09-28 22:27:14 647
原创 hdu4497GCD and LCM+数论
Description 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 great
2016-09-28 21:32:49 544
原创 codeforces373B+Anatoly and Cockroaches+贪心
Anatoly lives in the university dorm as many other students do. As you know, cockroaches are also living there together with students. Cockroaches might be of two colors: black and red. There are n coc
2016-09-28 17:58:19 301
原创 51nod1719数值计算+二分
令F(x)=∑wk=1(Ak+sin(k)sin(x+k)+Bk+cos(k)cos(x+k)) F(x)=∑^w_{k=1}(\frac {A}{k+sin(k)}sin(x+k)+\frac{B}{k+cos(k)}cos(x+k)) 求F(x)=0的前n小的正根的和。 n<=3e6,A<=1e3,B<=1e3n<=3e6,A<=1e3,B<=1e3 其中w是定值,为1e4 保留到小数
2016-09-28 11:56:57 372
原创 51nod1668非010串+矩阵快速幂
如果一个01字符串满足不存在010这样的子串,那么称它为非010串。 求长度为n的非010串的个数。(对1e9+7取模) Input一个数n,表示长度。(n<1e15)Output长度为n的非010串的个数。(对1e9+7取模)Input示例3Output示例7解释: 000 001 011 100 101 110 111对于这样的一个式子我们可以很快的写出dp的做法#includ
2016-09-28 11:42:37 629
原创 hdu5902GCD is Funny+数论
Problem Description Alex has invented a new game for fun. There are n integers at a board and he performs the following moves repeatedly:He chooses three numbers a, b and c written at the board and e
2016-09-25 22:21:37 1091
原创 hdu5904LCIS+dp+最长公共子串
LCIS Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 501 Accepted Submission(s): 231Problem Description Alex has two sequences a1,a2,…,an
2016-09-25 21:47:15 333
原创 hdu5204Rikka with sequence+数学
Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:Yuta have a sequence. Because the sequence is
2016-09-25 20:53:43 339
原创 问题模型积累
1.M面的筛子,扔n次,求n次中最大值的期望:解法:对于点数最大数i,情况数=in−(i−1)ni^n-(i-1)^n,除以总情况数mnm^n,所以概率为(i/m)n−((i−1)/m)n(i/m)^n-((i-1)/m)^n。所以期望为((i/m)n−((i−1)/m)n)∗i((i/m)^n-((i-1)/m)^n)*i;2.余数的和n%i=n−i×⌊ni⌋n\%i=n−i×⌊ni⌋∑ni=1K
2016-09-23 17:35:09 515
原创 数运算的一些模板
用过的一些模板 1.分数类的运算#include <utility>#include <algorithm>using namespace std;using namespace rel_ops;template <class VAL = long long> class Frac {public: VAL num,den; Frac(){} Frac(const
2016-09-21 18:14:11 332
原创 hdu5894hannnnah_j’s Biological Test+组合数学+Lucas
Problem Description hannnnah_j is a teacher in WL High school who teaches biology.One day, she wants to test m students, thus she arranges n different seats around a round table.In order to prevent ch
2016-09-21 15:37:07 429
原创 hdu5211Mutiple+数论
Description WLD likes playing with a sequence . One day he is playing with a sequence of integers. For every index i, WLD wants to find the smallest index ( if exists ), that , and mod =
2016-09-20 21:57:19 384
原创 hdu5207Greatest Greatest Common Divisor+枚举
Description Pick two numbers from a sequence to maximize the value of their greatest common divisor.Input Multiple test cases. In the first line there is an integer , indicating the number of
2016-09-20 21:15:15 395
原创 hdu5901Count primes+Lehmer求1-n的质数个数
Problem Description Easy question! Calculate how many primes between [1…n]!Input Each line contain one integer n(1 <= n <= 1e11).Process to end of file.Output For each case, output the number of pri
2016-09-18 20:34:55 757 5
原创 hdu5895Mathematician QSC+矩阵快速幂+除法取余
Problem Description QSC dream of becoming a mathematician, he believes that everything in this world has a mathematical law.Through unremitting efforts, one day he finally found the QSC sequence, it i
2016-09-18 20:14:34 1055
原创 hdu5033Building+计算几何+单调栈
Problem Description Once upon a time Matt went to a small town. The town was so small and narrow that he can regard the town as a pivot. There were some skyscrapers in the town, each located at positi
2016-09-16 23:13:57 1822
原创 hdu1251统计难题+字典树
Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提
2016-09-14 17:49:02 415
原创 字典树模板
#include<bits/stdc++.h>using namespace std;#define LL long longconst int sigma_size=2;struct TireNode{ int pass; int last; TireNode *son[29]; TireNode(){ pass=0; last
2016-09-14 16:41:10 212
原创 hdu5536Chip Factory+字典树
Problem Description John is a manager of a CPU chip factory, the factory produces lots of chips everyday. To manage large amounts of products, every processor has a serial number. More specifically, t
2016-09-14 15:45:45 431
原创 hdu5120Intersection+圆环的面积交
Problem Description Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know.A ring is a 2-D figure bounded b
2016-09-13 20:40:51 440
原创 hdu5512Pagodas+GCD
n pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1≤a≠b≤n) withstood the test o
2016-09-08 22:17:24 331
原创 hdu5510Bazinga+KMP
For n given strings S1,S2,⋯,Sn, labelled from 1 to n, you should find the largest i (1≤i≤n) such that there exists an integer j (1≤j< i) and Sj is not a substring of Si.A substring of a string Si is an
2016-09-08 21:01:34 375
原创 codeforces685A+DFS
Robbers, who attacked the Gerda’s cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.First, as they know that kingdo
2016-09-07 18:16:24 292
原创 hdu4111Alice and Bob+SG博弈
Description Alice and Bob are very smart guys and they like to play all kinds of games in their spare time. The most amazing thing is that they always find the best strategy, and that’s why they feel
2016-09-06 21:46:07 620
原创 BZOJ1257余数之和sum+数学
Description给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值,其中k mod i表示k除以i的余数。例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5=0+1+0+3+3=7Input输入仅一行,包含两个整数n, k。Output输出仅一行,即j(n,
2016-09-03 23:50:43 444
原创 codeforces454CLittle Pony and Expected Maximum+数学期望
DescriptionTwilight Sparkle was playing Ludo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dic
2016-09-03 20:56:09 331
原创 hdu5492Find a path+DP
Problem Description Frog fell into a maze. This maze is a rectangle containing N rows and M columns. Each grid in this maze contains a number, which is called the magic value. Frog now stays at grid (
2016-09-01 21:42:23 467
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人