ICPC Latin American Regional 2011
19
Problem K
Kings Poker
Problem code name: king
Poker is one of the most widely played card games, and Kings Poker is one of its variations. The
game is played with a normal deck of 52 cards. Each card has one of 4 suits

ICPC Latin American Regional 2011
15
Problem I
In Braille
Problem code name: inbraille
The Braille system, designed by Louis Braille in 1825, revolutionized written communication for
blind and visually impaired persons. Braille, a blind Frenchman, develop

ICPC Latin American Regional 2011
13
Problem H
Hedge Mazes
Problem code name: hedge
The Queen of Nlogonia is a fan of mazes, and therefore the queendoms architects built several
mazes around the Queens palace. Every maze built for the Queen is made of roo

ICPC Latin American Regional 2011
6
Problem D
Diccionario Portunol
Problem code name: diccionario
Portu
nol is a special language that was naturally developed in Latin America. Since almost half of
Latin America speaks Portuguese (Portugues) and almost ha

View from Top
Problem Statement
Tom was once playing with a set of cards and a grid of cells. Each card was a
rectangle of a unique color. Different cards may have had different dimensions. Tom
took his cards one at a time, and placed each of them onto th

No Same
Problem Statement
Tom has some colored bricks. Each color is described by an uppercase letter. Bricks of
each color all look exactly the same. Tom wants to arrange all her bricks into a row. A
row of bricks is nice if there is at most one pair of

ICPC Latin American Regional 2011
3
Problem B
Ball Stacking
Problem code name: ball
The XYZ TV channel is developing a new game show, where a contestant has to make some choices
in order to get a prize. The game consists of a triangular stack of balls, ea

ICPC Latin American Regional 2011
5
Problem C
Candys Candy
Problem code name: candy
Candy has a stock of candy of F different flavors. She is going to make several packs of candy to
sell them. Each pack must be either a flavored pack, containing candy of

ICPC Latin American Regional 2011
1
Problem A
Army buddies
Problem code name: army
Nlogonia is fighting a ruthless war against the neighboring country of Cubiconia. The Chief General
of Nlogonias Army decided to attack the enemy with a linear formation of

ICPC Latin American Regional 2011
17
Problem J
Jupiter Attacks!
Problem code name: jupiter
Jupiter is invading! Major cities have been destroyed by Jovian spacecrafts and humanity is fighting
back. Nlogonia is spearheading the counter-offensive, by hackin

Problem G
Recruiter's Problem
Input: Standard Input
Output: Standard Output
You are working as an HR officer in Nice Computer Programmer's Company(NCPC). You have
to hire a lot of people in a very short period. The hiring process is simple. Interview all

Trouble with sticky notes
Problem Statement
Tom wants to put N different size of square sticky notes on his boring wall. In order to
not making a mess like the picture below, Tom will place the sticky notes with all
sides of the note be parallel to the co

Problem D
Non-Decreasing Prime Sequence
Input: Standard Input
Output: Standard Output
A prime number is a natural number which has exactly two distinct natural number divisors. First
few prime numbers are: 2, 3, 5, 7, 11, 13, and so on.
A non decreasing p

Testing judge program
Problem Statement
Thanks to Bert and Ryan, our new judge system can accept multiple answers. I would
like to test the function now.
Input
There is no input.
Output
Please output a sequence of integers, at least two elements, separate

Cupcake
Problem Statement
Tom has N cupcakes. Each cupcake has one of three possible colors. In this problem
we will represent the colors by uppercase letters 'A', 'B', and 'C'. Two cupcakes of the
same color are indistinguishable. You are given a String

Sweets, lots of sweets
Problem Statement
Georg has a new profession: he now works in a candy factory. The job is way more
boring than it sounds: he is responsible for quality assurance. And that means taking
a box of candies, counting them and checking th

Jumping dimension
Problem Statement
As a grid jumper, Hayward can jump from grid (i,j) to any grids that is same column or
same row of the source grid. Now, he enters a new grid world, with r rows and c
columns. In this grid world, there are some treasure

Bit by Bit
Problem Statement
Alice and Bob play an interesting game. They start with a number n and follow
some rules until the game ends. The rules for the game are:
1. Let F(n) denotes the total no. of set bits in binary representation of numbers
from 0

Quick Exponentiation
Raising a number to its power is useful in many cryptographic applications. The
ability to compute the result fast in the context of a group Zm is required. The basic
problem reduces to computing the value of bp in the group Zm, where

Gems in the maze
Problem Statement
Scrooge has a new plan how to increase his wealth. He found ancient ruins with an
extraordinary maze. This maze consists of n chambers. The chambers are numbered
0 through n 1. Each chamber contains exactly one gem. Cham

Rebel Alliance attacks
Problem Statement
Oh no! The Rebel Alliance has found plans for a second Death Star the deadliest
weapon in the universe. It can destroy entire planets in a few seconds. If they allow it
to be unleashed, it will mean a certain defea

Sums
Find the sum of two integers.
Input
Input file contains multiple test cases. Each test case consists of two integers within
one line.
The absolute value of each input integer is in the range [0, 1024].
Output
For each test case, print the sum in sepa

Speed spell card!
PROBLEM STATEMENT
(This is not related to the original story of Touhou project)
Aya Shameimaru, the fastest moving girl, challenges Reimu Hakurei in the speed
racing without a reason. The race is like that, there are n cities. Cities are

Euclid Problem
The Problem
From Euclid it is known that for any positive integers A and B there exist such integers X and Y that
AX+BY=D, where D is the greatest common divisor of A and B. The problem is to find for given A and B
corresponding X, Y and D.

Yodaness Level
PROBLEM STATEMENT
Yoda is the wisest, and perhaps the most powerful Jedi of
his time. Yoda is a mysterious figure and he has many oddities. One of them is that
Yoda often changes the order of words in the sentence. For example, one of such

Palindromic Password
PROBLEM STATEMENT
Ms. Ciel loves rabbits. She has a large special cage for her rabbits. The special cage is
protected by a secret password consisting of exactly X characters. Each character of
her password is one of 'a'-'z'. Due to th

Problem G - Prime Path
The ministers of the cabinet were quite upset by the message from the Chief
of Security stating that they would all have to change the four-digit room
numbers on their offices.
It is a matter of security to change such things every

Mafia Game
Problem Statement
N friends (numbered from 0 to N-1) play a game called Mafia. The exact rules of the
game are not important for this problem. What's important is that at some point in
the game they will need to choose one player who will lose

History Grading
Problem Statement
Given the correct chronological order of n events
as
where
denotes the ranking of event i in the
correct chronological order and a sequence of student responses
where
denotes the chronological rank given by the student
to

Problem F - Printer Queue
The only printer in the computer science students' union is experiencing an
extremely heavy workload. Sometimes there are a hundred jobs in the printer
queue and you may have to wait for hours to get a single page of output.
Beca