CodeForces 621D – Rat Kwesh and Cheese [高精度取log]


Link 传送门 Problem Wet Shark asked Rat Kwesh to generate three positive real numbers x, y and z, from 0.1 to 200.0, inclusive. Wet Krash wants to impress Wet Shark, so all generated numbers will have exactly one digit after the decimal point. Wet...

CodeForces 621D – Rat Kwesh and Cheese [高精度取log]

Link 传送门 Problem Wet Shark asked Rat Kwesh to generate three positive real numbers x, y and z, from 0.1 to 200.0, inclusive. Wet Krash wants to ...
阅读全文 0

51nod 1270 – 数组的最大代价 [DP]


Link 传送门 Problem 数组A包含N个元素A1, A2……AN。数组B包含N个元素B1, B2……BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <= Bi。数组A的代价定义如下: (公式表示所有两个相邻元素的差的绝对值之和) 给出数组B,计算可能的最...

51nod 1270 – 数组的最大代价 [DP]

Link 传送门 Problem 数组A包含N个元素A1, A2……AN。数组B包含N个元素B1, B2……BN。并且数组A中的每一个元素Ai,都满足1 <= Ai <...
阅读全文 0

UVa 10535 – Shooter [贪心+几何]


Link 传送门 Problem The shooter is in a great problem. He is trapped in a “2D” maze with a laser gun and can use it once. The gun is very powerful and the laser ray, it emanates can traverse infinite distance in its direction. In the maze the targ...

UVa 10535 – Shooter [贪心+几何]

Link 传送门 Problem The shooter is in a great problem. He is trapped in a “2D” maze with a laser gun and can use it once. The gun is very powerful ...
阅读全文 0

UVa 254 – Towers of Hanoi [汉诺塔+二进制]


Link 传送门 Problem In 1883, Edouard Lucas invented, or perhaps reinvented, one of the most popular puzzles of all times – the Tower of Hanoi, as he called it – which is still used today in many computer science textbooks to demonstrat...

UVa 254 – Towers of Hanoi [汉诺塔+二进制]

Link 传送门 Problem In 1883, Edouard Lucas invented, or perhaps reinvented, one of the most popular puzzles of all times – the Tower of Hanoi...
阅读全文 0

FZU 1851 – 组合数 [数学+组合数质因子]


Link 传送门 Problem 组合数 C(N,M)=N!/(M!*(N-M)!). 问题是求 C(N,M)中不同的素因子的个数 输入包含多组数据(数据组数<= 10),每组数据只有一行 2个正整数表示N和M (1 <= M <= N <= 1000000) Analysis 非常好的一道数学题,受poj某道题题解的启发做出来...

FZU 1851 – 组合数 [数学+组合数质因子]

Link 传送门 Problem 组合数 C(N,M)=N!/(M!*(N-M)!). 问题是求 C(N,M)中不同的素因子的个数 输入包含多组数据(数据组数<= 10),每组数据只有一行 2个正整...
阅读全文 0

UVa 11552 – Fewest Flops [DP]


Link 传送门 Problem A common way to uniquely encode a string is by replacing its consecutive repeating characters (or “chunks”) by the number of times the character occurs followed by the character itself. For example, the string “aabbbaabaaaa” ma...

UVa 11552 – Fewest Flops [DP]

Link 传送门 Problem A common way to uniquely encode a string is by replacing its consecutive repeating characters (or “chunks”) by the number of ti...
阅读全文 0

UVa 1312 – Cricket Field [枚举]


Link 点击打开题目链接 Problem Once upon a time there was a greedy King who ordered his chief Architect to build a field for royal cricket inside his park. The King was so greedy, that he would not listen to his Architect’s proposals to build...

UVa 1312 – Cricket Field [枚举]

Link 点击打开题目链接 Problem Once upon a time there was a greedy King who ordered his chief Architect to build a field for royal cricket inside hi...
阅读全文 0

UVa 1344 – Tian Ji — The Horse Racing [贪心+分类讨论]


Link 点击打开题目链接 Problem Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest right now, he may discover that the horse racing problem can be simply viewed as finding the maximum ma...

UVa 1344 – Tian Ji — The Horse Racing [贪心+分类讨论]

Link 点击打开题目链接 Problem Were Tian Ji lives in nowadays, he will certainly laugh at himself. Even more, were he sitting in the ACM contest rig...
阅读全文 0

UVa 11134 – Fabled Rooks [贪心]


Link 点击打开题目链接 Problem We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to the following restrictions • The i-th rook can only be placed within the rectangle given by its left-upper corner (xli , yli) and its rightlowe...

UVa 11134 – Fabled Rooks [贪心]

Link 点击打开题目链接 Problem We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to the following restrictions • The i-th rook ...
阅读全文 0

LeetCode #29 – Divide Two Integers [思路]


Link 点击打开题目链接 Problem Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. Mean 计算INT内的两个数相除,不能使用乘法、除法和取模。 Analysis 首先想到除法变成减法,但是减法太慢了。这...

LeetCode #29 – Divide Two Integers [思路]

Link 点击打开题目链接 Problem Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. Mean ...
阅读全文 0