据说今年所有学校都没有推荐名额???
NOIP 初赛题目整理(C++)
POJ 3465 Battle 题解:可“反悔”的贪心
很多题目的贪心想法都是一个简单粗暴的贪心加上可“反悔”的操作。这样可以确保答案的正确性。
Description
You're Zhu Rengong, a formidable hero. After a number of challenging missions, you are finally facing the final Boss – a black dragon called Heilong. Due to his overwhelming power, you have to plan your actions carefully.
POJ 3244 Difference between Triplets 题解:(线段树或树状数组)或(排序 + 前缀和)
坠痛苦的是,POJ 的辣鸡 G++ 编译器不支持 long long
,害得我调试调了半天……
Description
For every pair of triplets, $T_a = (I_a, J_a, K_a)$ and $T_b = (I_b, J_b, K_b)$, we define the difference value between $T_a$ and $T_b$ as follows:
$$ D(T_a, T_b) = \max (I_a − I_b, J_a − J_b, K_a − K_b) − \min (I_a − I_b, J_a − J_b, K_a − K_b) $$
Now you are given $N$ triplets, could you write a program to calculate the sum of the difference values between every unordered pair of triplets?
POJ 3977 Subset 题解:折半搜索+二分查找
HDU 6447 YJJ's Salesman 题解:排序+离散+树状数组
Problem Description
YJJ is a salesman who has traveled through western country. YJJ is always on journey. Either is he at the destination, or on the way to destination.
One day, he is going to travel from city $A$ to southeastern city $B$. Let us assume that A is $(0,0)$ on the rectangle map and $B (10^9,10^9)$. YJJ is so busy so he never turn back or go twice the same way, he will only move to east, south or southeast, which means, if YJJ is at $(x,y)$ now $(0\leqslant x\leqslant 10^9,0\leqslant y\leqslant 10^9)$, he will only forward to $(x+1,y)$, $(x,y+1)$ or $(x+1,y+1)$.
HDU 5626 Clarke and points 题解:一道巧妙的贪心
Topcoder SRM 634 Div2 T3 SpecialStrings 题解
Topcoder Single Round Match 634 Div 2 T3 SpecialStrings 题解
Topcoder SRM 635 Div2 T3 LonglongestPathTree 题解
Topcoder Single Round Match 635 Div2 T3 LonglongestPathTree 题解
二分图匹配问题与匈牙利算法
Topcoder SRM 616 Div2 T3 TwoLLogo 题解
Topcoder Single Round Match 616 Div 2 T3 题解