Category: brute force
Count how many squares are there in the following figure. Easy validation by Python using Bruteforce, checking every possible pair of points (lower-left, and upper right) #!/usr/bin/env python # …
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://codeforces.com/contest/263/problem/A It looks complex but in fact it is not. There is only one ‘1’ element in this fixed-5X5 matrix. The shortest path to 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 …
The problem is from codeforces: http://www.codeforces.com/problemset/problem/262/A #!/usr/bin/env python n, k = map(int, raw_input().split()) s = raw_input().split() ans = 0 for x in s: ans += 1 if x.count('4') + x.count('7') …