上一页 1 ··· 9 10 11 12 13 14 下一页
摘要: 题意: 10000组数据 问一个数n[1,1e12] 在k进制下有末尾0的k的个数。 思路: 题意很明显,就是求n的因子个数,本来想直接预处理欧拉函数,然后拿它减n就行了。但注意是1e12次方法不可行。而一般的求因子显然也太慢,所有要想另一个办法。已知任意数可以分解成几个 质因数幂的乘积 ,所以求出 阅读全文
posted @ 2016-10-28 15:41 Lweleth 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 题意: 给出n [1,3 1e6] 求 并模2^64。 思路: 先手写出算式 观察发现可以化成 那么关键在于如何求得i为1~n的lcm(i,n)之和。可以知道lcm(a,b)为a b/gcd(a,b) 变换得(a/gcd) (b/gcd) gcd 由于GCD的性质,可以知道a/gcd 与 b/gcd 阅读全文
posted @ 2016-10-28 15:27 Lweleth 阅读(734) 评论(0) 推荐(0) 编辑
摘要: 题意 :求[a,b]内所有与b互质个数的平方。 思路 :简单的欧拉函数应用,由于T很大 先打表求前缀和 最后相减即可 初次接触欧拉函数 可以在素数筛选的写法上修改成欧拉函数。此外本题内存有限制 故直接计算平方值 include <stdio.h include <iostream inc 阅读全文
posted @ 2016-10-28 15:12 Lweleth 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximu 阅读全文
posted @ 2016-07-26 18:03 Lweleth 阅读(267) 评论(1) 推荐(0) 编辑
摘要: As the manager of your company, you have to carefully consider, for each project, the time taken to finish it, the deadline, and the profit you can ga 阅读全文
posted @ 2016-07-26 17:55 Lweleth 阅读(711) 评论(0) 推荐(0) 编辑
摘要: As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro 阅读全文
posted @ 2016-07-26 17:43 Lweleth 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 这题作为模板题,解法好多... 最近周围的人都在搞图论阿,感觉我好辣鸡,只会跟风学习。 暂时只有SPFA和Dijkstra的 SPFA (邻接表版。也可以写成临接矩阵存图,但题目可能给出平行边的,所以要注意找最小的边储存,还要注意判断一个点是否多次进入队列)老实说觉得SPFA好像只是被队列优化过的f 阅读全文
posted @ 2016-06-26 21:38 Lweleth 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Description An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very 阅读全文
posted @ 2016-05-17 12:23 Lweleth 阅读(366) 评论(0) 推荐(0) 编辑
摘要: Description N students were invited to attend a party, every student has some friends, only if someone’s all friends attend this party, this one can a 阅读全文
posted @ 2016-05-17 12:09 Lweleth 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Description There is a river, which contains n stones from left to right. These stones are magic, each one has a magic number Ai which means if you st 阅读全文
posted @ 2016-05-17 11:09 Lweleth 阅读(200) 评论(0) 推荐(0) 编辑
摘要: A wise man told Kerem "Different is good" once, so Kerem wants all things in his life to be different. Kerem recently got a string s consisting of low 阅读全文
posted @ 2016-05-17 10:47 Lweleth 阅读(174) 评论(0) 推荐(0) 编辑
摘要: A. Summer Camp Every year, hundreds of people come to summer camps, they learn new algorithms and solve hard problems. This is your first year at summ 阅读全文
posted @ 2016-05-17 10:42 Lweleth 阅读(225) 评论(0) 推荐(0) 编辑
摘要: D. Robin Hood We all know the impressive story of Robin Hood. Robin Hood uses his archery skills and his wits to steal the money from rich, and return 阅读全文
posted @ 2016-05-17 10:31 Lweleth 阅读(362) 评论(0) 推荐(0) 编辑
摘要: Problem Description 春天到了, HDU校园里开满了花, 姹紫嫣红, 非常美丽. 葱头是个爱花的人, 看着校花校草竞相开放, 漫步校园, 心情也变得舒畅. 为了多看看这迷人的校园, 葱头决定, 每次上课都走不同的路线去教室, 但是由于时间问题, 每次只能经过k个地方, 比方说, 这 阅读全文
posted @ 2016-05-08 23:44 Lweleth 阅读(239) 评论(3) 推荐(1) 编辑
摘要: Given a list of N integers A1, A2, A3,...AN, there's a famous problem to count the number of inversions in it. An inversion is defined as a pair of in 阅读全文
posted @ 2016-05-01 22:28 Lweleth 阅读(427) 评论(1) 推荐(0) 编辑
摘要: Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline 阅读全文
posted @ 2016-05-01 22:12 Lweleth 阅读(221) 评论(1) 推荐(0) 编辑
摘要: Problem Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of m 阅读全文
posted @ 2016-04-20 00:06 Lweleth 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Problem Description Read the program below carefully then answer the question.#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio> 阅读全文
posted @ 2016-04-08 21:28 Lweleth 阅读(270) 评论(0) 推荐(0) 编辑
摘要: Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 1000000007 (109 + 7). Inpu 阅读全文
posted @ 2016-04-06 20:35 Lweleth 阅读(209) 评论(1) 推荐(0) 编辑
摘要: Description A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) ar 阅读全文
posted @ 2016-04-05 23:44 Lweleth 阅读(233) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 下一页