- 博客(94)
- 收藏
- 关注
原创 LIGHT OJ 1189 - Sum of Factorials【贪心+递归】
1189 - Sum of Factorials PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBGiven an integer n, you have to find whether it can b
2016-08-26 22:18:12 733 1
原创 LIGHT OJ 1064 - Throwing Dice 【dp数塔+打表】
1064 - Throwing Dice PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBn common cubic dice are thrown. What is the probability tha
2016-08-26 01:29:22 344
原创 LIGHT OJ 1122 - Digit Count【DP数塔】
1122 - Digit Count PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBGiven a set of digits S, and an integer n, you have to find h
2016-08-25 22:40:23 411
原创 LIGHT OJ 1047 - Neighbor House 【DP数塔】
1047 - Neighbor House PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBThe people of Mohammadpur have decided to paint each of
2016-08-25 21:57:46 293
原创 LIGHT OJ 1307 - Counting Triangles【二分枚举】
1307 - Counting Triangles PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBYou are given N sticks having distinct lengths; you ha
2016-08-25 21:45:03 491
原创 LIGHT OJ 1109 - False Ordering 【因子个数】
1109 - False Ordering PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBWe define b is a Divisor of a number a if a is divisible b
2016-08-25 21:24:30 362
原创 LIGHT OJ 1006 - Hex-a-bonacci 【化简递推式(DP)】
1006 - Hex-a-bonacci PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBGiven a code (not optimized), and necessary inputs, you h
2016-08-25 21:03:28 421
原创 LIGHT OJ 1331 - Agent J 【余弦定理+海伦公式】
1331 - Agent J PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBAgent J is preparing to steal an antique diamond piece from a mus
2016-08-25 20:27:49 508
原创 LIGHT OJ 1225 - Palindromic Numbers (II)【回文数】
1225 - Palindromic Numbers (II) PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBA palindromic number or numeral palindrome is
2016-08-25 20:14:17 469
原创 LIGHT OJ 1136 - Division by 3【找规律】
1136 - Division by 3 PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBThere is sequence 1, 12, 123, 1234, ..., 12345678910, ... .
2016-08-25 20:03:12 507
原创 LIGHT OJ-1022 - Circle in Square【浮点精度】
1022 - Circle in Square PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBA circle is placed perfectly into a square. The term p
2016-08-25 19:21:15 377
原创 LIGHT OJ-1305 - Area of a Parallelogram 【向量叉积】
1305 - Area of a Parallelogram PDF (English)StatisticsForumTime Limit: 1 second(s)Memory Limit: 32 MBA parallelogram is a quadrilateral with two pairs
2016-08-25 19:12:08 367
原创 LIGHT OJ-1182 - Parity 【按位与】
1182 - Parity PDF (English)StatisticsForumTime Limit: 0.5 second(s)Memory Limit: 32 MBGiven an integer n, first we represent it in binary. Then we cou
2016-08-25 18:55:10 325
原创 HDU 2063 过山车 【二分图最大匹配(匈牙利模板)】
过山车Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 19030 Accepted Submission(s): 8304Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐
2016-08-24 21:26:19 377
原创 CodeForces 597A Divisibility【二元一次方程(区间解数) 讨论)】
A. Divisibilitytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFind the number of k-divisible numbers on th
2016-08-24 00:32:06 416
原创 LIGHToj 1282 - Leading and Trailing 【对数+快速幂取模】
1282 - Leading and Trailing PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBYou are given two integers: n and k, your task is to
2016-08-24 00:19:51 414
原创 LIGHTOJ 1045 - Digits of Factorial 【阶乘取对数】
1045 - Digits of Factorial Time Limit: 2 second(s) Memory Limit: 32 MBDescriptionFactorial of an integer is defined by the following functionf(0) = 1f(n) = f(n - 1) * n, if(n > 0)So, fac
2016-08-23 21:02:57 873
原创 POJ 2891 Strange Way to Express Integers 【中国剩余定理线性模方程合并(模板)】
Strange Way to Express IntegersTime Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu DescriptionElina is reading a book written by Rujia Liu, which introduces a strange way to expr
2016-08-23 12:19:29 434
原创 CodeForces 653A Bear and Three Balls 【sort+去重(unique)】
Bear and Three Ballr Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u scription:Limak is a little polar bear. He has n balls, the i-th ball has size ti.Limak wants to g
2016-08-22 21:48:42 385
原创 CodeForces 554B Ohana Cleans Up 【思维+map】
Ohana Cleans UpTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u DescriptionOhana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares.
2016-08-22 21:21:48 293
原创 CodeForces 632B Co-prime Array 【GCD(互质)】
Co-prime ArrayTime Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u DescriptionYou are given an array of n elements, you must make it a co-prime array in as few moves as possib
2016-08-22 20:59:32 352
原创 CodeForces-632B Alice, Bob, Two Teams 【dp】
Alice, Bob, Two TeamsTime Limit:1500MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u DescriptionAlice and Bob are playing a game. The game involves splitting up game pieces into two team
2016-08-22 20:39:52 308
原创 POJ-1006 Biorhythms 【中国剩余定理模板】
C - BiorhythmsTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %lluSubmitStatusPractice Description人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人
2016-08-21 22:02:10 424
原创 字典树学习总结
解决问题:主要应对多次查询,典例就是字典,字典树就是一本字典,字典的最大好处就是能快速查询;主要原理:我们在查某一个单词时总会先索引第一个字母,然后在查第二个字母,以此类推直到查到此单词为止,那么字典树的查询过程也是如此,先查第一个字母的节点位置,然后在该节点的子节点之中查询第二个字母的位置,以此类推,直到查到最后一个字母,就相当于我们查到了这个单词;想一想我们在查字典时查到某个字母,这个字母
2016-08-19 01:04:53 355
原创 HDU-1247 Hat’s Words【字典树(逆向思维)】
F - Hat’s WordsTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in
2016-08-18 23:06:47 857
原创 HDU-4825 Xor Sum 【字典树+位异或】
B - Xor SumTime Limit:1000MS Memory Limit:132768KB 64bit IO Format:%I64d & %I64u Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Z
2016-08-18 20:36:04 1080
原创 HDU 1251 统计难题 【动态存储+字典树(模板)】
A - 统计难题Time Limit:2000MS Memory Limit:65535KB 64bit IO Format:%I64d & %I64uSubmitStatusPracticeDescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本
2016-08-18 14:38:25 284
原创 素数表学习总结
素数表的打法多种多样,每种都有其特点,学习了几种,总结一下。 思路:第四种:从小到大判断素数,再用素数的倍数是合数筛去合数,保留素数 ,重复性高;第三种是根据一个合数的最小质因子《=sqrt(N) 来筛选;第一种将不必要的访问去除,通过一个合数的最小素因子将其筛去,大大优化了时间复杂度; 如果需要将素数存起来,这时标记和保存数组就可以用一个了,素数0,1位置开始存都可以 prime[0]=2,pr
2016-08-17 23:45:46 399
原创 树状数组学习总结
int lowbit(int x)//计算更新需要的增量 { return x&(-x);//return x&(x^(x-1))}一维树状数组: 局限性:只适用于对点更新和对区间查询; 如果对求区间最值不能用,得用线段树;如果要进行区间的更新和点的查询,可以将Update() 和sum()的内部更新顺序转变,但此时c[]数已不是定义的树状数组了。void add(int pos,i
2016-08-17 01:11:03 220
原创 二分 【离散化】
L - 二分Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u SubmitStatus Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As
2016-08-16 21:08:34 573
原创 STL学习总结
1.string : string erase函数的使用:#include <iostream>#include <string>using namespace std;int main (){ string str ("This is an example phrase."); string::iterator it; // 第(1)种用法
2016-08-16 00:24:41 237
原创 HDU-2087 剪花布条 【KMP简单变型】
剪花布条Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16151 Accepted Submission(s): 10225Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些
2016-08-15 17:42:53 306
原创 HDU-1115 Bungee Jumping
Bungee JumpingTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatusPracticeHDU 1155 Description Once again, James Bond is fleeing from some evil people who want t
2016-08-14 19:20:48 268
原创 常见错误总结
本文主要是对自己的一些常用但模糊的知识点和常犯错误总结,这些错误很简单但比较容易忽略,在解题或比赛时出现这种错误实在不值得,只要在用这些东西的时候多考虑一下是否合适就能避免此类问题。H. 对于手误不可避免,在写程序多注意,不要要求过快,只要保证写的逻辑和代码不出现问题即可,如果真的出现错误了,不要急,确保一边检查出来,平常写程序时尽量模块化,这样不仅思路清晰而且出现错误方便检查,确定错误区间范围,
2016-08-14 01:12:18 228
原创 Uva-10200 Prime Time 【素数+打表+浮点精度】
10200 - Prime TimeEuler is a well-known matematician, and, among many other things, he discovered that the formula n 2 + n + 41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681,
2016-08-14 00:05:40 418
原创 Codeforces-546D Soldier and Number Game 【质因子分解+打表+DP】
D. Soldier and Number Game time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Two soldiers are playing a game. At the beginning first of them
2016-08-13 21:53:04 421
原创 LIGHT OJ-1104 Birthday Paradox 【组合】
1104 - Birthday ParadoxTime Limit: 2 second(s) Memory Limit: 32 MBSometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party
2016-08-13 18:20:32 284
原创 HDU-1513 Palindrome 【LCS+滚动数组】
PalindromeTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5241 Accepted Submission(s): 1796Problem Description A palindrome is a symmetrica
2016-08-13 09:22:36 283
原创 LIS学习总结
1.LIS含义:最长递增子序列,可以连续,也可以不连续,只要是最长的就行,注意和连续递增子序列的区别。 2.算法功能:不仅可以求出给定序列的最长递增子序列的长度,而且可以求出给定以序列中任意项结尾的最长递增子序列的长度。设数列a1,a2,a3,a4,a5……..a(n-1),an, (也可以是字符串); a.解法:用动态规划求解主要是动态方程的推导: 1.设dp[i] : 以a[i]结尾的最
2016-08-13 02:07:11 966
原创 HDU-1051 Wooden Sticks 【二维LIS(STL应用)+排序】
D - Wooden SticksTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description There is a pile of n wooden sticks. The length and weight of each stick ar
2016-08-12 23:12:01 391
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人