原创 LeetCodeOJ. Count and Say

試題請參見: https://oj.leetcode.com/problems/count-and-say/ 題目概述 The count-and-say sequence is the sequence of integers b

原创 Vijos.1096 津津的儲蓄計劃

試題請參見: https://vijos.org/p/1096 題目概述 津津的零花錢一直都是自己管理。每個月的月初媽媽給津津300元錢,津津會預算這個月的花銷,並且總能做到實際花銷和預算的相同。  爲了讓津津學習如何儲蓄,媽媽提出,津津

原创 Vijos1016.北京2008的掛鐘

試題請參見: https://vijos.org/p/1016 題目概述 在2008北京奧運會雄偉的主會場的牆上, 掛着如上圖所示的3*3的九個掛鐘(一開始指針即時針指向的位置請根據輸入數據調整). 然而此次奧運會給與了大家一

原创 Vijos1093. 文科生的悲哀

試題請參見: https://vijos.org/p/1093 題目概述 在這一學期一共有n次文科考試,考試科目有4種,分別爲政治、歷史、地理和綜合。每次考哪一科是不定的,因此在考試前Matrix67不知道應該去複習哪一科的功課。他希望能

原创 POJ1664.放蘋果

試題請參見: http://poj.org/problem?id=1664 題目概述 把M個同樣的蘋果放在N個同樣的盤子裏, 允許有的盤子空着不放, 問共有多少種不同的分法?(用K表示)5, 1, 1和1, 5, 1 是同一種分

原创 LeetCodeOJ.Longest Substring Without Repeating Characters

試題請參見: https://leetcode.com/problems/longest-substring-without-repeating-characters/ 題目概述 Given a string, find the leng

原创 POJ2054.Color a Tree

試題請參見: http://poj.org/problem?id=2054 Also available on: http://acm.hdu.edu.cn/showproblem.php?pid=1055 題目概述 Bob is ve

原创 HDOJ1004.Let the Balloon Rise

試題請參見: http://acm.hdu.edu.cn/showproblem.php?pid=1004 題目概述 Contest time again! How excited it is to see balloons floati

原创 POJ1562.Oil Deposits

試題請參見: http://poj.org/problem?id=1562 題目概述 The GeoSurvComp geologic survey company is responsible for detecting underg

原创 LeetCode. Container With Most Water

試題概述 Given n non-negative integers a1 , a2 , …, an , where each represents a point at coordinate (i, ai). n vertical li

原创 HDOJ1010.Tempter of the Bone

試題請參見: http://acm.hdu.edu.cn/showproblem.php?pid=1010 題目概述 The doggie found a bone in an ancient maze, which fascinated

原创 HDOJ1009.FatMouse' Trade

試題請參見: http://acm.hdu.edu.cn/showproblem.php?pid=1009 題目概述 FatMouse prepared M pounds of cat food, ready to trade with

原创 HDOJ1016.Prime Ring Problem

試題請參見: http://acm.hdu.edu.cn/showproblem.php?pid=1016 題目概述 A ring is compose of n circles as shown in diagram. Put natu

原创 蛇形矩陣

本題的來源是2016年的騰訊春季校招筆試題。 我只是被人抱了大腿。(o´・ェ・`o) 試題描述 蛇形矩陣:作爲一種常用的數學數列,是由1開始的自然數依次排列成的N*N的正方形矩陣,數字依次由外向內遞增,如下面實例: n = 3的蛇形矩陣

原创 LeetCode.Word Break

試題請參見: https://leetcode.com/problems/word-break/ 題目概述 Given a string s and a dictionary of words dict, determine if s c