Monthly Archives: April 2013

AliceBob : Codeforces Problem 6C

Problem link: http://codeforces.com/problemset/problem/6/C

Problem Statement:
Alice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — from right to left. For each chocololate bar the time, needed for the player to consume it, is known (Alice and Bob eat them with equal speed). When the player consumes a chocolate bar, he immediately starts with another. It is not allowed to eat two chocolate bars at the same time, to leave the bar unfinished and to make pauses. If both players start to eat the same bar simultaneously, Bob leaves it to Alice as a true gentleman.

How many bars each of the players will consume?
Continue reading

Advertisements

PalindromeMaker : TopCoder Problem 5881

[The problem appeared in TopCoder SRM 274 (Div-2, Level-2) and SRM 274 (Div-1, Level-1)]
Problem link: http://community.topcoder.com/stat?c=problem_statement&pm=5881&rd=8071

Problem Statement:
A palindrome is a string that is spelled the same forward and backward. We want to rearrange letters of the given string baseString so that it becomes a palindrome.

You will be given a String baseString. Return the palindrome that can be made from baseString. When more than one palindrome can be made, return the lexicographically earliest (i.e., the one that occurs first in alphabetical order). Return “” (the empty string) if no palindromes can be made from baseString.
Continue reading