- 博客(71)
- 资源 (1)
- 收藏
- 关注
原创 【SPOJ】AIBOHP - Aibohphobia
Problem hereSolution答案=原字串長度-原字串與其反轉後字串的lcm一開始用top down寫,TLE orz…. 之後改成 bottom up 才AC#include <iostream>#include <string>using namespace std;string input, res;int lcs[6101][6101];int main(){
2017-05-03 00:11:30 622
原创 【POJ】Symmetric Order
Problem hereSolution#include <iostream>#include <string>#include <vector>using namespace std;vector<string> strs;int n, cnt = 0;void solve(int a, int b){ if(b == strs.size() || a == strs.size()
2017-02-28 01:21:51 586
原创 【UVa】10684 - The jackpot
Problem hereProblemAs Manuel wants to get rich fast and without too much work, he decided to make a career in gambling. Initially, he plans to study the gains and losses of players, so that, he can id
2016-11-07 23:08:14 553
原创 【POJ】Sumsets
Problem hereDescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the possible
2016-10-08 01:02:56 424
原创 【UVa】10298 - Power Strings
Problem hereGiven 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, exponen
2016-09-10 11:08:02 571
原创 【UVa】455 - Periodic Strings
Problem here A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, the string ”abcabcabcabc” has period
2016-09-10 00:48:50 388
原创 【TopCoder】ZigZag - 2003 TCCC Semifinals 3
Problem StatementA sequence of numbers is called a zig-zag sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists)
2016-09-03 00:01:19 487
原创 【POJ】Balance
Problem hereDescriptionGigel has a strange “balance” and he wants to poise it. Actually, the device is different from any other ordinary balance. It orders two arms of negligible weight and each arm’
2016-08-28 23:48:02 545
原创 【POJ】Painter
Problem hereDescriptionThe local toy store sells small fingerpainting kits with between three and twelve 50ml bottles of paint, each a different color. The paints are bright and fun to work with, and h
2016-08-25 23:41:11 515
原创 【CodeForces】〖 Educational Codeforces Round 16〗A. King Moves
Problem hereProblemThe only king stands on the standard chess board. You are given his position in format “cd”, where c is the column from ‘a’ to ‘h’ and d is the row from ‘1’ to ‘8’. Find the number o
2016-08-23 16:13:54 501
原创 【POJ】Power of Cryptography
DescriptionCurrent work in cryptography involves (among other things) large prime numbers and computing powers of numbers among these primes. Work in this area has resulted in the practical use of resu
2016-08-22 12:32:31 374
原创 【POJ】Y2K Accounting Bug
Problem hereDescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc.
2016-08-20 13:03:26 448
原创 【POJ】Frogger
Problem hereDescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and
2016-08-20 12:44:39 725
原创 【POJ】Heavy Transportation
Problem hereDescriptionBackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way fr
2016-08-20 12:43:04 413
原创 玩脫了的最小生成樹
p.s.來玩一個XDD Minimum Spanning Tree(MST)可以通過Prim 和 Kruskal算法來實現Prim簡單點來說就是由’點’出發以這張圖為例吧我們以華山作為起點我們可以走到武當山(2)、嵩山(8)和恆山(5)其中因為走到武當山的路程最短因此我們先把武當山納入我們的領土很好,現在我們可以走到嵩山(8或7)和恆山(5)因為去恆山的路程較短所以我們先去征服恆山這樣我們現在可以
2016-08-12 20:32:58 529
原创 【POJ】Stockbroker Grapevine
Problem hereDescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactic
2016-08-12 20:30:31 335
原创 【POJ】Jungle Roads
Problem hereDescription The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtake
2016-08-12 20:29:26 352
原创 【POJ】A Knight's Journey
Problem hereDescriptionBackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it i
2016-08-12 20:27:48 359
原创 【POJ】Highways
Problem hereDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of thi
2016-08-12 20:27:07 262
原创 【HDU】Red and Black
Problem hereProblem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of fo
2016-08-12 20:26:17 516
原创 【HDU】畅通工程
Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后
2016-08-12 20:24:35 380
原创 【UVa】524 - Prime Ring Problem
Problem hereProblemA ring is composed of n (even number) circles as shown in diagram. Put natural numbers 1, 2, … , n into each circle separately, and the sum of numbers in two adjacent circles shoul
2016-08-12 20:23:53 644
原创 【UVa】12325 - Zombie's Treasure Chest
Problem hereProblemSome brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest, but with angry zombies. The warriors are so brave that they de
2016-08-12 20:23:22 749
原创 【UVa】208 - Firetruck
Problem [here](“https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=144&mosmsg=Submission+received+with+ID+17612154“)ProblemThe Center City fire de
2016-08-12 20:22:13 1019
原创 【USACO】Transformations
ProblemA square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation that has bee
2016-08-12 20:21:18 438
原创 【USACO】Milking Cows
ProblemThree farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The
2016-08-12 20:19:27 817
原创 【CodeForces】C. Drazil and Factorial
Problem hereProblemDrazil is playing a math game with Varda.Let’s define for positive integer x as a product of factorials of its digits. For example, First, they choose a decimal number a consisting
2016-05-07 22:56:12 2889
原创 【CodeForces】A. Pouring Rain
Problem hereProblemA lot of people in Berland hates rain, but you do not. Rain pacifies, puts your thoughts in order. By these years you have developed a good tradition — when it rains, you go on the s
2016-05-01 17:59:47 952
原创 【CodeForces】Registration system
problem hereProblemA new e-mail service “Berlandesk” is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that’s why they ask
2016-04-27 02:07:55 571
原创 【topcoder】 SRM 144 div 2 200
ProblemProblem StatementComputers tend to store dates and times as single numbers which represent the number of seconds or milliseconds since a particular date. Your task in this problem is to write a
2016-04-24 13:03:51 685
原创 【UVa】495 - Fibonacci Freeze
Problem hereProblemThe Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, …) are defined by the recurrence:eqnarray20Write a program to calculate the Fibonacci Numbers.INPUT&OUTPUTThe input to you
2016-04-18 23:55:14 1088
原创 【LeetCode】70. Climbing Stairs
Problem hereProblemYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Solution這題之前做過 就是
2016-04-17 00:44:17 332
原创 【NEFU】17-数字三角形
Problem hereProblem7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 给出了一个数字三角形。从三角形的顶部到底部有很多条不同的路径。对于每条路径,把路径上面的数加起来可以得到一个和,你的任务就是找到最大的和。 注意:路径上的每一步只能从一个数走到下一层上和它最近的左边的那个数或者右边的那个数。INPUT输入数据有多组,每组输入的是一行是一个整数N (
2016-04-16 00:48:45 377
原创 【HDU】2041-超级楼梯
Problem hereProblem有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?INPUT输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。OUTPUT对于每个测试实例,请输出不同走法的数量Sampleinput2 2 3output1 2Solution設x為樓梯數 f(
2016-04-15 23:53:22 346
原创 【GoogleCodeJam Qualification Round 2016】Problem A. Counting Sheep
Problem hereProblemBleatrix Trotter the sheep has devised a strategy that helps her fall asleep faster. First, she picks a number N. Then she starts naming N, 2 × N, 3 × N, and so on. Whenever she name
2016-04-10 11:30:33 833
原创 【UVa】11389 - The Bus Driver Problem
Problem hereProblemIn a city there are n bus drivers. Also there are n morning bus routes and n afternoon bus routes with various lengths. Each driver is assigned one morning route and one evening rou
2016-04-10 03:14:06 641
原创 【UVa】11456 - Trainsorting
Problem hereProblemErin is an engineer. She drives trains. She also arranges the cars within each train. She prefers to put the cars in decreasing order of weight, with the heaviest car at the front o
2016-04-07 23:26:57 585
原创 【UVa】10819 - Trouble of 13-Dots
Problem hereProblemDo you know 13-Dots? She is the main character of a well-known Hong Kong comic series. She is famous of her beauty, as well as the variety of stylish clothes she wears. Now 13-Dots
2016-04-07 00:53:53 600
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人