Simplified Chess Engine
Chess is a very popular game played by hundreds of millions of people. Nowadays, we have chess engines such as Stockfish and Komodo to help us analyze games. These engines are very powerful pieces of well-developed software that use intelligent ideas and algorithms to analyze positions and sequences of moves, as well as find tactical ideas. Consider the following simplified version of chess: Board: It's played on a board between two players named Black and White. Pieces and Movement: White
View Solution →Password Cracker
There are n users registered on a website CuteKittens.com. Each of them has a unique password represented by pass[1], pass[2], ..., pass[N]. As this a very lovely site, many people want to access those awesomely cute pics of the kittens. But the adamant admin does not want the site to be available to the general public, so only those people who have passwords can access it. Yu, being an awesome hacker finds a loophole in the password verification system. A string which is a concatenation of o
View Solution →Arithmetic Expressions
5-year-old Shinchan had just started learning mathematics. Meanwhile, one of his studious classmates, Kazama, had already written a basic calculator which supports only three operations on integers: multiplication , addition , and subtraction . Since he had just learned about these operations, he didn't know about operator precedence, and so, in his calculator, all operators had the same precedence and were left-associative. As always, Shinchan started to irritate him with his silly questions
View Solution →Stone Division, Revisited
You have a pile of stones that you want to split into multiple piles, as well as a set, , of distinct integers. We define a move as follows: First, choose a pile of stones. Let's say that the chosen pile contains stones. Next, look for some such that and is divisible by (i.e., is a factor of ); if such an exists, you can split the pile into equal smaller piles. You are given queries where each query consists of and . For each query, calculate the maximum possible number of moves
View Solution →Bowling Pins
Bowling is a sport in which a player rolls a bowling ball towards a group of pins, the target being to knock down the pins at the end of a lane. In this challenge, the rules of the game are slightly modified. Now, there are a given number of pins, and the pins are arranged in a horizontal line instead of a triangular formation. Two players have to play this game, taking alternate turns. Whoever knocks down the last pin(s) will be declared the winner. You are playing this game with your fri
View Solution →