• 博客(3083)
  • 收藏
  • 关注

codeforces Epic Game 题解

Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon receives numberaand Antisimon receives numberb. They a...

2014-04-30 07:16:00 903

Codeforces Helpful Maths

Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.The teacher has written down the sum of multiple numbers. ...

2014-04-30 07:11:00 777

Unique Binary Search Trees -- LeetCode


2014-04-30 06:16:00 826

Unique Binary Search Trees II -- LeetCode

原题链接:http://oj.leetcode.com/problems/unique-binary-search-trees-ii/这道题是求解所有可行的二叉查找树,从Unique Binary Search Trees中我们已经知道,可行的二叉查找树的数量是相应的卡特兰数,不是一个多项式时间的数量级,所以我们要求解所有的树,自然是不能多项式时间内完成的了。算法上还是用求解NP问题的方法来求...

2014-04-30 06:15:00 281


Gabor的核函数参考的wiki使用实数Real的公式计算核函数代码:Mat gaborFilter(Mat& img, Mat& filter){ int half_filter_size = (max(filter.rows,filter.cols)-1)/2; Mat filtered_img(img.rows,img.cols,CV_32F); for(int...

2014-04-30 00:36:00 380

Codeforces A. Double Cola 题解

题目很奇怪,就是5个人排队喝可乐,喝完之后编程两个人,然后拍在队后面,然后继续喝可乐。给出个数值,代表第几罐可乐,问会是第几个人喝到?http://codeforces.com/problemset/problem/82/A一个数学问题,仔细点就好了。要熟练的知识点:1 要熟悉解决这种递增数列,如何减去循环部分2 要知道如何计算,求余取答案#include &...

2014-04-29 18:16:00 305

Timus 1119. Metro 动态规划

Many of SKB Kontur programmers like to get to work by Metro because the main office is situated quite close the station Uralmash. So, since a sedentary life requires active exercises off-duty, man...

2014-04-29 15:05:00 191

Timus 1104. Don’t Ask Woman about Her Age题解

Mrs Little likes digits most of all. Every year she tries to make the best number of the year. She tries to become more and more intelligent and every year studies a new digit. And the number she ...

2014-04-29 12:27:00 238

Timus 1446. Sorting Hat 分类问题

At the start of each school year, a very important event happens at Hogwarts. Each of the first-year wizards and witches is assigned to one of the four Hogwarts houses. The bravest children are pu...

2014-04-29 09:31:00 202

Timus 1777. Anindilyakwa 奇怪的数数问题

The language of Australian aborigines anindilyakwa has no numerals. No anindilyakwa can say: “I've hooked eight fishes”. Instead, he says: “I've hooked as many fishes as many stones are in thi...

2014-04-29 08:43:00 178

Restore IP Addresses -- LeetCode


2014-04-29 05:01:00 159

Interleaving String -- LeetCode


2014-04-29 04:28:00 192

Timus 1644. A Whole Lot of Walnuts 算法

Ten big walnuts is a whole lot of walnuts, that's for sure! Two walnuts is too little for anybody. How about six walnuts? Is it a small number of walnuts or a large one? The Parrot has already fou...

2014-04-28 19:26:00 159

Timus 1510. Order 找到出现次数过半的数

A New Russian Kolyan likes two things: money and order. Kolyan has lots of money, but there is no order in it. One beautiful morning Kolyan understood that he couldn't stand this any longer and de...

2014-04-28 18:19:00 228

Timus 1161. Stripies

Our chemical biologists have invented a new very useful form of life calledstripies(in fact, they were first called in Russian -polosatiki, but the scientists had to invent an English name to appl...

2014-04-28 16:08:00 166

Timus 1642. 1D Maze迷宫

1D people lived in a 1D country. Everything in the country was one-dimensional, and everything was simple and clear: just one axis and two directions — forward and backward. Even a 1D world has pr...

2014-04-28 15:28:00 202

Timus 2002. Test Task 一个登陆系统

It was an ordinary grim October morning. The sky was covered by heavy gray clouds. It was a little rainy. The rain drops fell on the windows with quiet bangs. Ilya was sitting at the computer and ...

2014-04-28 15:04:00 156

Timus 1601. AntiCAPS 修正大写句子

The blonde Angela has a new whim: internet chats. Of course, as any blonde, she writes her messages using the upper case. You are the moderator of Angela's favorite chat and you're fed up with her...

2014-04-28 14:59:00 193

Timus 1180. Stone Game 游戏题目

Two Nikifors play a funny game. There is a heap ofNstones in front of them. Both Nikifors in turns take some stones from the heap. One may take any number of stones with the only condition that ...

2014-04-28 09:02:00 171

Timus 1796. Amusement Park 聪明题

On a sunny Sunday, a group of children headed by their teacher came to an amusement park. Aunt Frosya, who was a very kind and quiet person, worked at the ticket window on that day. The teacher ga...

2014-04-28 07:52:00 189

Reverse Linked List II -- LeetCode


2014-04-28 04:58:00 130

Subsets II -- LeetCode


2014-04-28 04:23:00 131

Timus 2011. Long Statement 排列组合的运用

Nikita, a schoolboy, is currently taking part in one of programming contests. He is really upset because all the problem statements are so long and unclear. So he took the statement of the first p...

2014-04-27 20:44:00 104

Timus 1404. Easy to Hack! 有一个密码问题

When Vito Maretti writes an important letter he encrypts it. His method is not very reliable but it’s enough to make any detective understand nothing in that letter. Sheriff doesn’t like such stat...

2014-04-27 20:04:00 126

Timus 1120. Sum of Sequential Numbers 数学题

There is no involute formulation concerning factitiously activity of SKB Kontur in this problem. Moreover, there is no formulation at all.InputThere is the only numberN, 1 ≤N≤ 109....

2014-04-27 19:31:00 123

Timus 1139. City Blocks 题解

The blocks in the city of Fishburg are of square form.Navenues running south to north andMstreets running east to west bound them. A helicopter took off in the most southwestern crossroads and f...

2014-04-27 16:50:00 138

Timus 2005. Taxi for Programmers 题解

The clock shows 11:30 PM. The sports programmers of the institute of maths and computer science have just finished their training. The exhausted students gloomily leave their computers. But there’...

2014-04-27 10:53:00 133

Timus 1712. Cipher Grille 题解

Our program committee uses different tools for problem development: a mailing list, a version control system, an administration system of theTimus Online Judgewebsite, and many others. Chairman ...

2014-04-27 09:15:00 151

Timus 1935. Tears of Drowned 详解

Old Captain Jack Sparrow’s friend Tia Dalma, the fortuneteller and prophetess, often makes potions. She has an outstanding collection of the rarest ingredients such as rat tails, fingers of drowne...

2014-04-27 07:28:00 136

Decode Ways -- LeetCode


2014-04-27 06:18:00 143

Recover Binary Search Tree -- LeetCode


2014-04-27 03:09:00 141

Timus 1025. Democracy in Danger 题解

BackgroundIn one of the countries of Caribbean basin all decisions were accepted by the simple majority of votes at the general meeting of citizens (fortunately, there were no lots of them). O...

2014-04-26 19:34:00 179

Timus 1654. Cipher Message 破解密码

Müller tried to catch Stierlitz red-handed many times, but always failed because Stierlitz could ever find some excuse. Once Stierlitz was looking through his email messages. At that moment, Mülle...

2014-04-26 18:44:00 119

Timus 1792. Hamming Code 题解

Let us consider four disks intersecting as in the figure. Each of the three shapes formed by the intersection of three disks will be called apetal.Write zero or one on each of the disks. The...

2014-04-26 15:34:00 136

Timus 1131. Copying 数学公式的构造

A new educating program was received by the kindergarten. Of course, children have discovered it immediately and want to play with it as soon as possible. In order to let them do it the program ha...

2014-04-26 14:25:00 101

Timus 1837. Isenbaev's Number 图论 题解

Vladislav Isenbaev is a two-time champion of Ural, vice champion of TopCoder Open 2009, and absolute champion of ACM ICPC 2009. In the time you will spend reading this problem statement Vladislav ...

2014-04-26 13:19:00 131

Gray Code -- LeetCode


2014-04-26 06:22:00 143

Binary Tree Zigzag Level Order Traversal -- LeetCode

原题链接:http://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/这道题其实还是树的层序遍历Binary Tree Level Order Traversal,如果不熟悉的朋友可以先看看哈。不过这里稍微做了一点变体,就是在遍历的时候偶数层自左向右,而奇数层自右向左。在Binary Tree Level...

2014-04-26 04:31:00 144

Scramble String -- LeetCode

原题链接:http://oj.leetcode.com/problems/scramble-string/这道题看起来是比较复杂的,如果用brute force,每次做切割,然后递归求解,是一个非多项式的复杂度,一般来说这不是面试官想要的答案。这其实是一道三维动态规划的题目,我们提出维护量res[i][j][n],其中i是s1的起始字符,j是s2的起始字符,而n是当前的字符串长度,res[i][j...

2014-04-26 02:50:00 129

Timus 1723. Sandro's Book 题解

It's been quite a number of years since Lich Sandro retired. Sometimes in the evenings, when he feels especially lonely, he takes a book that was presented to him by his student magicians on the o...

2014-04-25 18:41:00 147



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


取消 删除