Category: greedy algorithm
January 24, 2013
algorithms, beginner, brute force, codeforces, greedy algorithm, implementation, math, programming languages, python, search, simulation, tricks
The problem is from codeforces: http://www.codeforces.com/contest/265/problem/B This problem is not difficult, but it took me nearly 1:30 hr to get it right during the contest. I thought at first, the …
The problem is from codeforces: http://www.codeforces.com/problemset/problem/262/B Two hints used to solve this problem are greedy and sorted numbers. The greedy approach turns negative numbers one by one in non-decreasing order …
In , the basic 0/1 knapsack is discussed. For each item, you can choose to put or not to put into the knapsack. Therefore, for the number of items, …
The problem is from codeforces: http://www.codeforces.com/problemset/problem/239/A It is a simple math problem: finding the numbers x that satisify where y, k, and n are given;
The problem is from codeforces: http://www.codeforces.com/problemset/problem/137/B It took me several attempts to get it right for this problem although it is not difficult. The problem is find out how …