Tag: greedy
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/245/E The minimal number of people can be obtained by greedy approach, assuming that at each possible cases, the same people entered and left …
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/158/B Solution is easy: First you need to sort the group numbers in desending order. You create two index pointers, pointing to the start …