- 博客(38)
- 收藏
- 关注
原创 Count the string(kmp+dp)
Count the stringIt is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. Fo
2018-01-31 10:40:50 229
原创 Seek the Name, Seek the Fame (kmp)
Seek the Name, Seek the FameThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek
2018-01-30 22:46:08 197
原创 Power Strings
Power StringsGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, expon
2018-01-30 17:12:00 329
原创 剪花布条
剪花布条一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不
2018-01-30 16:34:53 345
原创 The Great Mixing CodeForces - 788C (BFS)
The Great MixingCodeForces - 788CSasha and Kolya decided to get drunk with Coke, again. This time they have k types of Coke. i-th type is characterised by its carbon dioxide concentrat
2018-01-29 18:24:43 305
原创 黄金分割数
黄金分割数黄金分割数0.61803... 是个无理数,这个常数十分重要,在许多工程问题中会出现。有时需要把这个数字求得很精确。对于某些精密工程,常数的精度很重要。也许你听说过哈勃太空望远镜,它首次升空后就发现了一处人工加工错误,对那样一个庞然大物,其实只是镜面加工时有比头发丝还细许多倍的一处错误而已,却使它成了“近视眼”!!言归正传,我们如何求得黄金分割数的尽可能精确的值
2018-01-29 16:46:00 1605
原创 New Year and Curling CodeForces - 908C
New Year and CurlingCodeForces - 908CCarol is currently curling.She has n disks each with radius r on the 2D plane. Initially she has all these disks above the line y = 10100.She
2018-01-29 12:18:36 230
原创 Bellovin HDU - 5748 (最长上升子序列)
BellovinHDU - 5748Peter has a sequence a1,a2,...,an and he define a function on the sequence -- F(a1,a2,...,an)=(f1,f2,...,fn), where fi is the length of the longest increasing sub
2018-01-28 22:45:05 298
原创 One-Dimensional Battle Ships CodeForces - 567D (二分做法+解释)
One-Dimensional Battle ShipsCodeForces - 567DAlice and Bob love playing one-dimensional battle ships. They play on the field in the form of a line consisting ofn square cells (that is,
2018-01-28 19:02:07 437
原创 Play a game (博弈论)
Play a gameNew Year is Coming! ailyanlu is very happy today! and he is playing a chessboard game with 8600. The size of the chessboard is n*n. A stone is placed in a corner square. They pl
2018-01-28 16:22:48 1014
原创 F(x) HDU - 4734 (数位dp)
F(x)HDU - 4734For a decimal number x with n digits (A nA n-1A n-2 ... A 2A 1), we define its weight as F(x) = An * 2 n-1 + A n-1 * 2 n-2 + ... + A 2 * 2 + A 1 * 1. Now you are given tw
2018-01-28 12:36:27 175
原创 不要62 HDU - 2089(数位dp)
不要62HDU - 2089杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如: 62315 73418 88914 都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以...
2018-01-28 11:13:53 289
原创 How Many Pieces of Land ? UVA - 10213 (计算几何公式)
How Many Pieces of Land ?UVA - 10213LemmaIf we already have n points on the circle and add one more point, we drawn lines from the new point to previously existing points. Two cases
2018-01-28 10:01:06 391
原创 Coin Game HDU - 3951 (简单博弈)
Coin GameHDU - 3951After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.The game goes like this: Two players start the game with
2018-01-27 15:43:19 391
原创 Bubble Sort HDU - 5775 (树状数组)
Bubble SortHDU - 5775 P is a permutation of the integers from 1 to N(index starting from 1).Here is the code of Bubble Sort in C++.for(int i=1;i<=N;++i) for(int j=N,t;j&g...
2018-01-27 15:23:18 251
原创 Sumdiv POJ - 1845 (数论)
SumdivPOJ - 1845 Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 9901).InputThe ...
2018-01-26 23:56:36 625
原创 Appleman and Card Game CodeForces - 462B (贪心)
Appleman and Card GameCodeForces - 462BAppleman has n cards. Each card has an uppercase letter written on it. Toastman must choosek cards from Appleman's cards. Then Appleman should gi
2018-01-26 17:33:57 445
原创 4个数和为0 51Nod - 1267
4个数和为051Nod - 1267给出N个整数,你来判断一下是否能够选出4个数,他们的和为0,可以则输出"Yes",否则输出"No"。Input 第1行,1个数N,N为数组的长度(4 <= N <= 1000)第2 - N + 1行:Ai(-10^9 <= Ai<= 10^9) Output 如果可以选出4个数,使得他们的和为0,则输出"Yes",否则输出"No"。 Sa
2018-01-26 17:31:31 239
原创 Mike and Chocolate Thieves CodeForces - 689C (二分思想)
Mike and Chocolate ThievesCodeForces - 689CBad news came to Mike's village, some thieves stole a bunch of chocolates from the local factory! Horrible!Aside from loving sweet things,
2018-01-26 17:24:53 266
原创 Two Cakes
Two CakesIt's New Year's Eve soon, so Ivan decided it's high time he started setting the table. Ivan has bought two cakes and cut them into pieces: the first cake has been cut intoa pieces,
2018-01-26 11:01:04 920
原创 New Year and Buggy Bot
New Year and Buggy BotBob programmed a robot to navigate through a 2d maze.The maze has some obstacles. Empty cells are denoted by the character '.', where obstacles are denoted by '#'.
2018-01-26 10:58:00 260
原创 New Year and Counting Cards
New Year and Counting CardsYour friend has n cards.You know that each card has a lowercase English letter on one side and a digit on the other.Currently, your friend has laid out the car
2018-01-26 10:55:25 280
原创 Jamie and Alarm Snooze
Jamie and Alarm SnoozeJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by set
2018-01-26 10:52:40 381
原创 Perfect Squares (水题)
Perfect SquaresGiven an array a1, a2, ..., an ofn integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists
2018-01-26 10:50:46 1066
原创 三分查找
一. 概念原文:http://blog.csdn.net/beiyouyu/article/details/7875480 在二分查找的基础上,在右区间(或左区间)再进行一次二分,这样的查找算法称为三分查找,也就是三分法。三分查找通常用来迅速确定最值。二分查找所面向的搜索序列的要求是:具有单调性(不一定严格单调);没有单调性的序列不是使用二分查找。与二分查找不同的是
2018-01-23 11:19:00 222
原创 The Moving Points HDU - 4717 (三分查找)
The Moving PointsHDU - 4717There are N points in total. Every point moves in certain direction and certain speed. We want to know at what time that the largest distance between any two point
2018-01-23 11:16:34 228
原创 Permute Digits CodeForces - 915C (DFS)
Permute DigitsCodeForces - 915CYou are given two positive integer numbers a andb. Permute (change order) of the digits ofa to construct maximal number not exceedingb. No number in
2018-01-23 10:13:12 421
原创 Browser CodeForces - 915B
BrowserCodeForces - 915BLuba is surfing the Internet. She currently has n opened tabs in her browser, indexed from1 to n from left to right. The mouse cursor is currently located at th
2018-01-23 10:09:39 390
原创 How Many Fibs? UVA - 10183 (java)
How Many Fibs?UVA - 10183直接用java大数做,注意一点的是斐波那契数组超过500时,斐波那契数就超过100位了,所以开600的数组足矣import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String []ar
2018-01-23 10:04:43 267
原创 Garden CodeForces - 915A
GardenCodeForces - 915ALuba thinks about watering her garden. The garden can be represented as a segment of lengthk. Luba has got n buckets, thei-th bucket allows her to water some con
2018-01-23 09:59:18 367
原创 Another Problem on Strings CodeForces - 165C
Another Problem on StringsCodeForces - 165CA string is binary, if it consists only of characters "0" and "1".String v is a substring of string w if it has a non-zero length and can b
2018-01-23 09:56:16 311
原创 Burning Midnight Oil CodeForces - 165B
Burning Midnight OilCodeForces - 165BOne day a highly important task was commissioned to Vasya — writing a program in a night. The program consists ofn lines of code. Vasya is already ex
2018-01-23 09:38:27 648
原创 第39级台阶
第39级台阶小明刚刚看完电影《第39级台阶》,离开电影院的时候,他数了数礼堂前的台阶数,恰好是39级!站在台阶前,他突然又想着一个问题:如果我每一步只能迈上1个或2个台阶。先迈左脚,然后左右交替,最后一步是迈右脚,也就是说一共要走偶数步。那么,上完39级台阶,有多少种不同的上法呢?请你利用计算机的优势,帮助小明寻找答案。要求提交的是一个整数。注意:不要提交解答过程,或其
2018-01-22 11:28:04 448
原创 Sine之舞(qdulq)(40 point(s))
Sine之舞(qdulq)(40 point(s))最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功。所以他准备和奶牛们做一个“Sine之舞”的游戏,寓教于乐,提高奶牛们的计算能力。 不妨设 An=sin(1–sin(2+sin(3–sin(4+...sin(n))...) Sn=(...(A1+n)A2+n-1)A3+.
2018-01-22 11:16:04 175
原创 Huffuman树(qdulq)(40 point(s))
Huffuman树(qdulq)(40 point(s))Huffman树在编码中有着广泛的应用。在这里,我们只关心Huffman树的构造过程。给出一列数{pi}={p0, p1, …, pn-1},用这列数构造Huffman树的过程如下: 1. 找到{pi}中最小的两个数,设为pa和pb,将pa和pb从{pi}中删除掉,然后将它们的和加入到{pi}中。这个过程的费用
2018-01-22 10:52:21 159
原创 马虎的算式
马虎的算式小明是个急性子,上小学的时候经常把老师写在黑板上的题目抄错了。有一次,老师出的题目是:36 x 495 = ?他却给抄成了:396 x 45 = ?但结果却很戏剧性,他的答案竟然是对的!!因为 36 * 495 = 396 * 45 = 17820类似这样的巧合情况可能还有很多,比如:27 * 594 = 297 * 54假设 a b c d e 代表1~9不
2018-01-22 10:38:51 608
原创 高斯日记
1799-07-161799-07-16题目标题: 高斯日记大数学家高斯有个好习惯:无论如何都要记日记。他的日记有个与众不同的地方,他从不注明年月日,而是用一个整数代替,比如:4210后来人们知道,那个整数就是日期,它表示那一天是高斯出生后的第几天。这或许也是个好习惯,它时时刻刻提醒着主人:日子又过去一天,还有多少时光可以用于浪费呢?高斯出生于:1777年4月30日。在高斯发现
2018-01-22 10:32:15 209
原创 Fermat vs. Pythagoras POJ - 1305(本原勾股数组)
Fermat vs. PythagorasPOJ - 1305Computer generated and assisted proofs and verification occupy a small niche in the realm of Computer Science. The first proof of the four-color problem was comp
2018-01-09 19:48:28 279
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人