task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
DNA Translation (DNA) Deoxyribonucleic acid (DNA) is composed of a sequence of nucleotide bases paired together to form a double-stranded helix structure. Through a series of complex biochemical processes the nucleotide sequences in an organism's DNA are translated into the proteins it requires for life. The obje...
31,000
Perfect Cubes (CUBES) For hundreds of years Fermat's Last Theorem, which stated simply that for n > 2 there exist no integers a , b , c > 1 such that a n = b n + c n , has remained elusively unproven. (A recent proof is believed to be correct, though it is still undergoing scrutiny.) It is possible, ...
31,001
Galactic Import (IMPORT) With the introduction of the new ThrustoZoom gigadimensional drive, it has become possible for HyperCommodities, the import/export conglomerate from New Jersey, to begin trading with even the most remote galaxies in the universe. HyperCommodities wants to import goods from some of the gala...
31,002
Basically Speaking (BASE) The Really Neato Calculator Company, Inc. has recently hired your team to help design their Super Neato Model I calculator. As a computer scientist you suggested to the company that it would be neato if this new calculator could convert among number bases. The company thought this was a...
31,003
Letter Sequence Analysis (SEQUENCE) Cryptographic analysis makes extensive use of the frequency with which letters and letter sequences occur in a language. If an encrypted text is known to be in English, for example, a great deal can be learned from the fact that the letters E, L, N, R, S, and T are the most comm...
31,004
Mark-up (MARKUP) Mark-up languages are computer languages that assist in the formatting of text files. Special keywords are used to mark the text to allow control of fonts, page styles, paragraph styles, etc. TeX, troff, and HTML are examples of mark-up languages. Spell checking can be difficult to adapt to these...
31,005
Transmitters (TRANSMIT) In a wireless network with multiple transmitters sending on the same frequencies, it is often a requirement that signals don't overlap, or at least that they don't conflict. One way of accomplishing this is to restrict a transmitter's coverage area. This problem uses a shielded transmitter ...
31,006
Ws Cipher (WSCIPHER) Weird Wally's Wireless Widgets, Inc. manufactures an eclectic assortment of small, wireless, network capable devices, ranging from dog collars, to pencils, to fishing bobbers. All these devices have very small memories. Encryption algorithms like Rijndael, the candidate for the Advanced Encry...
31,007
Split Windows (SPLIT) The Dotty Software Company makes software that is displayed on inexpensive text based terminals. One application for this system has a main window that can be subdivided into further subwindows. Your task is to take a description of the screen layout after a sequence of window splits and dra...
31,008
Index Generation (INDEXGEN) Most nonfiction and reference books have an index to help readers find references to specific terms or concepts in the text. Here is a sample index. larch, 4, 237, 238, 414 + Monty Python and, 64, 65, 66 + planting of, 17 Lenny Kravitz, 50 + going his way, 53 lumbago, 107 mango...
31,009
Hangover (HANGOVER) How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be perpendicular to the table.) With two cards you can make the top card overhang the bottom one by half a card length, and...
31,010
Double Vision (DOUBLEVI) The DoubleVision company designs inks and fonts that can be easily read by both humans and machines. They design their fonts on a rectangular grid. Shown below is a very simple 5x3 design for the first five digits. .o. .o. oo. oo. o.o o.o .o. ..o ..o o.o o.o .o. .o. oo. ooo o.o .o. o.....
31,011
Image Perimeters (IMAGE) Technicians in a pathology lab analyze digitized images of slides. Objects on a slide are selected for analysis by a mouse click on the object. The perimeter of the boundary of an object is one useful measure. Your task is to determine this perimeter for selected objects. The digitized sl...
31,012
Submatrix of submatrix (MATRIX2) You are given a matrix P of N rows and M columns. It consists of integer numbers in the range [1..100]. We define the sum of a matrix is the sum of its elements. Your task is to find a submatrix Q (of A rows and B columns) of P and a submatrix K (of C rows and D columns) of Q so that t...
31,013
Query on a tree II (QTREE2) You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3 ... N -1. Each edge has an integer value assigned to it, representing its length. We will ask you to perform some instructions of the following form: DIST a b : ask for the d...
31,014
Free Tour (FTOUR) In order to celebrate the 2nd anniversary of Travel Agent SPOJ (Safe – Professional – hOspitable – Joyful), the management intend to hold free tours around cities for clients to make them more satisfied with SPOJ. A tour is a simple cycle, starting at any city (called a source-city) visits som...
31,015
Intergalactic Map (IM) Jedi knights, Qui-Gon Jinn and his young apprentice Obi-Wan Kenobi, are entrusted by Queen Padmé Amidala to save Naboo from an invasion by the Trade Federation. They must leave Naboo immediately and go to Tatooine to pick up the proof of the Federation’s evil design. They then must proceed...
31,016
Entrapment (EN) The separatist leader General Grievous, the second in command of Count Dooku, comes to know that Chancellor Palpatine’s convoy, escorted by Obi-wan and Anakin, is scheduled to depart from Kashyyyk in the Middle Rim of the Universe to Alderaan . General Grievous is aware that there are multiple paths...
31,017
Parking Bay (PB) Luke Skywalker successfully leads the rebel starship fleet to break the Emperor's siege of the planet Endor. The rebels, jubilant in their victory, return to their base on the moon of Endor to pay their homage to Princess Leia. They fly towards the parking bay where there are n parking slots in a row....
31,018
Birthday (BIRTHDAY) It is Byteman’s birthday today. There are n children at his birthday party (including Byteman). The children are numbered from 1 to n. Byteman’s parents have prepared a big round table and they have placed n chairs around the table. When the children arrive, they take seats. The child number 1 take...
31,019
Mobile (MOBILE) Manfred loves to build mobiles out of old CDs. For each one, he has an exact plan how it should look like: The CDs are all hanging exactly on the same height. For each pair of CDs, he writes down the height of the lowest bar such that both CDs are hanging somewhere under this bar. For example, the fol...
31,020
Continuous Fractions (CFRAC) A simple continuous fraction has the form: where the ai’s are integer numbers. The previous continuous fraction could be noted as [a1, a2, . . . , an]. It is not difficult to show that any rational number p / q , with integers p > q > 0, can be represented in a unique way by a simple...
31,021
Generalized Matrioshkas (MATRIOSH) Vladimir worked for years making matrioshkas, those nesting dolls that certainly represent truly Russian craft. A matrioshka is a doll that may be opened in two halves, so that one finds another doll inside. Then this doll may be opened to find another one inside it. This can be repe...
31,022
Equidivisions (EQDIV) An equidivision of an n × n square array of cells is a partition of the n 2 cells in the array in exactly n sets, each one with n contiguous cells. Two cells are contiguous when they have a common side. A good equidivision is composed of contiguous regions. The figures show a good and a wrong ...
31,023
Babylonian Roulette (BROUL) People of Babylon were devoted to chance games and one of the most popular was a special kind of roulette. Recently, some old Babylonian tablets were found. They described details of the roulette game. In modern terms, the rules of the game were as follows: Roulette’s compartments had...
31,024
Uncle Jack (UJ) Dear Uncle Jack is willing to give away some of his collectable CDs to his nephews. Among the titles you can find very rare albums of Hard Rock, Classical Music, Reggae and much more; each title is considered to be unique. Last week he was listening to one of his favorite songs, Nobody’s fool, and real...
31,025
Little Quilt (QUILT) Little Quilt is a small language introduced by Ravi Sethi in his book ‘Programming Languages’. Here, a restricted version of Little Quilt is presented. The language is defined by the following BNF grammar: < QUILT > ::= A | B | turn(< QUILT >) | sew(< QUILT >,< QUILT >) A and B represen...
31,026
Polygon Encoder (POLYCODE) Imagine an infinite table with rows and columns numbered using the natural numbers. The following figure shows a procedure to traverse such a table assigning a consecutive natural number to each table cell: This enumeration of cells can be used to represent complex data types using natur...
31,027
Aibohphobia (AIBOHP) BuggyD suffers from AIBOHPHOBIA - the fear of Palindromes. A palindrome is a string that reads the same forward and backward. To cure him of this fatal disease, doctors from all over the world discussed his fear and decided to expose him to large number of palindromes. To do this, they decided...
31,028
Angels and Devils (ANGELS) It's the year 21546 AD, and due to increased population (you wouldn't believe me if I gave you the actual numbers), land has become very expensive. Because of the lack of space, Heaven and Hell were built in the same area. The area can be represented as a grid of X × Y unit squares. Some...
31,029
Complete Chess Boards (COMCB) BuggyD has always been fascinated with chess boards (though he really sucks at chess). He makes an observation that a chess board is complete with respect to knights and rooks and incomplete with respect to bishops (unless the dimensions are 1 × 1). A complete chess board is one in whic...
31,030
Fashion Shows (FASHION) A fashion show rates participants according to their level of hotness. Two different fashion shows were organized, one for men and the other for women. A date for the third is yet to be decided ;) . Now the results of both fashion shows are out. The participants of both the fashion shows ha...
31,031
Favorite Dice (FAVDICE) BuggyD loves to carry his favorite die around. Perhaps you wonder why it's his favorite? Well, his die is magical and can be transformed into an N-sided unbiased die with the push of a button. Now BuggyD wants to learn more about his die, so he raises a question: What is the expected numbe...
31,032
Fool the Police (FPOLICE) Dhamaka Singh (a crook) has just robbed a bank and would like to get out of the country as soon as possible. But there is a slight problem, the police! On his way out of the country he has to pass through some police stations. Each police station has a certain risk (for Dhamaka Singh) associ...
31,033
Hubulullu (HUBULLU) After duelling in quake (a multiplayer game), Airborne and Pagfloyd decide do test themselves out in another game called Hubulullu. The rules of the game are as follows: N wooden pieces (marked with numbers 1 to N) are placed in a transparent bottle. On his turn the first player takes out some...
31,034
Matrix Summation (MATSUM) A N × N matrix is filled with numbers. BuggyD is analyzing the matrix, and he wants the sum of certain submatrices every now and then, so he wants a system where he can get his results from a query. Also, the matrix is dynamic, and the value of any cell can be changed with a command in such...
31,035
Triple Fat Ladies (EIGHTS) Pattern Matchers have been designed for various sorts of patterns. Mr. HKP likes to observe patterns in numbers. After completing his extensive research on the squares of numbers, he has moved on to cubes. Now he wants to know all numbers whose cube ends in 888. Given a number k , help...
31,036
Up Subsequence (UPSUB) If x = a 0 a 1 a 2 ... a n-1 is a string where a i denotes the character at index i, a subsequence a j0 a j1 a j2 ... a jn is called an upsubsequence if a j0 ≤ a j1 ≤ a j2 ≤ ... ≤ a jn and j0 < j1 < j2 < ... < jn. A maximal upsubsequence of a string is defined as the upsubsequence of ...
31,037
Can you answer these queries I (GSS1) You are given a sequence A[1], A[2] ... A[N] . ( |A[i]| ≤ 15007 , 1 ≤ N ≤ 50000 ). A query is defined as follows: Query(x, y) = Max { a[i] + a[i+1] + ... + a[j] ; x ≤ i ≤ j ≤ y }. Given M queries, your program must output the results of these queries. Input The fi...
31,038
Card Trick (CTRICK) The magician shuffles a small pack of cards, holds it face down and performs the following procedure: The top card is moved to the bottom of the pack. The new top card is dealt face up onto the table. It is the Ace of Spades. Two cards are moved one at a time from the top to the bottom. The...
31,039
Sudoku (SUDOKU) A Sudoku grid is a 16x16 grid of cells grouped in sixteen 4x4 squares, where some cells are filled with letters from A to P (the first 16 capital letters of the English alphabet), as shown in the figure. The game is to fill all the empty grid cells with letters from A to P such that each letter from...
31,040
Number Steps (NSTEPS) Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2, ... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued.     You are to write a program that reads the coor...
31,041
Tic-Tac-Toe ( I ) (TOE1) Tic Tac Toe is a child's game played on a 3 by 3 grid. One player, X, starts by placing an X at an unoccupied grid position. Then the other player, O, places an O at an unoccupied grid position. Play alternates between X and O until the grid is filled or one player's symbols occupy an entire l...
31,042
Tic-Tac-Toe ( II ) (TOE2) In the game of tic-tac-toe, two players take turns marking squares of an initially empty 3 × 3 grid with either X’s or O’s. The first player always marks squares using X’s, whereas the second player always marks squares using O’s. If at any point during the game either player manages to mark ...
31,043
Java vs C ++ (JAVAC) Apologists of Java and C++ can argue for hours proving each other that their programming language is the best one. Java people will tell that their programs are clearer and less prone to errors, while C++ people will laugh at their inability to instantiate an array of generics or tell them that th...
31,044
Dead Fraction (DEADFR) Mike is frantically scrambling to finish his thesis at the last minute. He needs to assemble all his research notes into vaguely coherent form in the next 3 days. Unfortunately, he notices that he had been extremely sloppy in his calculations. Whenever he needed to perform arithmetic, he just pl...
31,045
Move To Invert (MINCOUNT) A triangle made of coins of height h is as follows: It has h coins at the base and h-1 coins one level above base and so on. (Coins are placed as shown in the figure below.) At the top-most level there will be only one coin. Now given h, the task is to invert this triangle by moving...
31,046
Sorted bit squence (SORTBIT) Let's consider the 32 bit representation of all integers i from m up to n inclusive (m ≤ i ≤ n; m × n ≥ 0, -2 31 ≤ m ≤ n ≤ 2 31 -1). Note that a negative number is represented in 32 bit Additional Code. That is the 32 bit sequence, the binary sum of which and the 32 bit representation of ...
31,047
Accomodate the palace (PALACE) There is a big palace in which rooms are constructed in the from of a square matrix. Now these rooms have to be filled with people. As there are conflicts between people to maintain the equilibrium total number of people must be odd in every row and every column. A room can accommod...
31,048
Origin of Life (ORIGLIFE) Conway's Game of Life is not really a game, but a cellular automaton -- a set of rules describing interactions among adjacent cells on a grid. In our game, we have an n by m rectangular grid of cells identified by integer coordinates ( x, y ). The game progresses through a series of s...
31,049
CN Tower (Easy) (CNEASY) Christy C. Coder is traveling to Waterloo for a programming competition. On the way, she stops in Toronto to do some sightseeing. The unfortunate thing about travelling is that everyone back home expects her to bring back pictures of everything. Christy hates taking pictures: it makes her look...
31,050
CN Tower (Hard) (CNHARD) Christy C. Coder is traveling to Waterloo for a programming competition. On the way, she stops in Toronto to do some sightseeing. The unfortunate thing about travelling is that everyone back home expects her to bring back pictures of everything. Christy hates taking pictures: it makes her look...
31,051
Paint By Numbers (PNTBYNUM) Years ago, there was a really bad craft/hobby called paint-by-numbers : you were given a line drawing, with numbers in each enclosed region, and the number corresponded to a particular colour. An example is shown below (unsolved on the left; solved on the right): (images from ThisLife.o...
31,052
Continuous Fractions Again (CFRAC2) A simple continuous fraction has the form: where the ai’s are integer numbers. The previous continuous fraction could be noted as [a1, a2, ..., an]. It is not difficult to show that any rational number p / q, with integers p > q > 0, can be represented in a unique way by a...
31,053
4 values whose sum is 0 (SUMFOUR) The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) belongs to A x B x C x D are such that a + b + c + d = 0. In the following, assume that all lists have the same size n. Input The first line...
31,054
Partial Sums (PARTSUM) Given a sequence of positive integers a 1 , a 2 , ..., a N , and 1 ≤ i ≤ j ≤ N , the partial sum from i to j is a i + a i +1 + ... + a j . In this problem, you will be given such a sequence and two integers P and K . Your task is to find the smallest partial sum modulo P ...
31,055
A Chase In WonderLand (CHASE) Alice is in Wonderland. It is March and March Hare is raving mad. It begins to chase Alice. Alice runs as fast as she can, but she comes to the the edge of a quicksand pool. Now this pool has several safe spots where she may comfortably step on without being swallowed by the quicksand. Sh...
31,056
Matrix (KPMATRIX) The company you work in has got a secret job to do. Just a few persons know what it is all about. To keep a secret every programmer works on a small part of the project. Your job is as follows. You are given a matrix of integer numbers with N rows and M columns. Also two integer numbers A and B...
31,057
Maze (KPMAZE) The King of Byteland likes Greek mythology very much. The most impressive myth for him is the one about Minotaur. A creature which was imprisoned in a maze-like construction. Now The King wants to have similar maze. He ordered to his architect to build such construction. The architect decided that...
31,058
Summing to a Square Prime (CZ_PROB1) $S_{P2} = \{p \mid p: \mathrm{prime} \wedge (\exists x_1, x_2 \in \mathbb{Z}, p = x_1^2 + x_2^2) \}$ is the set of all primes that can be represented as the sum of two squares. The function $S_{P2}(n)$ gives the $n$ th prime number from the set $S_{P2}$. Now, given two integers $n...
31,059
The Cats and the Mouse (CATM) In a rectangular field of size n by m squares there is a mouse and two cats. The mouse is the first to make a move, then each of the cats makes a move, then again its the mouse's turn, and so on. In each move both the mouse and the cats can move exactly one square vertically or horizontal...
31,060
A Game with Numbers (NGM) Nikifor and Trofim play the following game: they write some positive integer smaller than 2,000,000,000 and take turns one after another. Nikifor is the first to make a move. The turn is made by the following rule: from the written integer any non-zero digit is subtracted, and the new integer...
31,061
Geometry and a Square (GEOM) Is there anyone who doesn't love geometry?! Just imagine: on the plane you are given a square ABCD, with vertices given in the clockwise direction. Also given is a point P which is different from all of A, B, C or D. Have you imagined it? Interested? Ok, let's continue! Through vertex A ...
31,062
Goods (FIRM) There are n dealers in the market. Each of them has some unique goods (nobody else has the same goods). Besides, each of them wants to obtain some other goods, which exist in the market. This is rather strange, but for each kind of goods on the market there exists exactly one dealer who wants to obtain ...
31,063
Projections Of A Polygon (KPPOLY) You are given a convex polygon on Cartesian coordinate system. It has projections on X and Y-axis. You can arbitrarily rotate this polygon. What minimum and maximum sum of projections can you achieve? Input First line contains one integer number N (3 ≤ N ≤ 100) - number of polyg...
31,064
The Sum (KPSUM) One of your friends wrote numbers 1, 2, 3, ..., N on the sheet of paper. After that he placed signs + and - between every pair of adjacent digits alternately. Now he wants to find the value of the expression he has made. Help him. For example, if N=12 then +1 -2 +3 -4 +5 -6 +7 -8 +9 -1+0 -1+1 -1+2 =...
31,065
Equation (KPEQU) You are given integer positive number N. Find the number of solutions in positive integer numbers of the following equation: 1/N! = 1/X + 1/Y Input Each line of input file contains one integer number N (1 ≤ N ≤ 10 4 ). The last line contains 0 and shouldn't be processed. Number of lines in the ...
31,066
Vertex Cover (PT07X) You are given an unweighted, undirected tree. Write a program to find a vertex set of minimum size in this tree such that each edge has as least one of its end-points in that set. Input The first line of the input file contains one integer N --- number of nodes in the tree (0 < N <= ...
31,067
Is it a tree (PT07Y) You are given an unweighted, undirected graph. Write a program to check if it's a tree topology. Input The first line of the input file contains two integers N and M --- number of nodes and number of edges in the graph (0 < N <= 10000, 0 <= M <= 20000). Next M lines contain M ...
31,068
Longest path in a tree (PT07Z) You are given an unweighted, undirected tree. Write a program to output the length of the longest path (from one node to another) in that tree. The length of a path in this case is number of edges we traverse from source to destination. Input The first line of the input file co...
31,069
Use of Function Arctan (ARCTAN) It's easy to know that arctan(1/2) + arctan(1/3) = arctan(1). Given number A, write a program to calculate the minimum sum B+C. A, B and C are all positive integers and satisfy the equation below: arctan(1/A) = arctan(1/B) + arctan(1/C) Input The first line contains a integer num...
31,070
The Clever Typist (CLEVER) Blue Mary is a typist of some secret department. Now she has to type in many passwords in an hour, each of which has a fixed length: 6.Of course, the fewer times she presses the keyboard, the happier she is. Unfortunately, the keyboard to type in the password is extraordinary designed to k...
31,071
Strange Food Chain (CHAIN) There are 3 kinds of animals A, B and C. A can eat B, B can eat C, C can eat A. It's interesting, isn't it? Now we have n animals, numbered from 1 to n. Each of them is one of the 3 kinds of animals: A, B, C. Today Mary tells us k pieces of information about these n animals. Each piece h...
31,072
DEL Command II (DELCOMM2) It is required to find out what's the maximum number of files that can be deleted from MS-DOS directory executing the DEL command of MS-DOS operation system only once. There are no nested subdirectories. Note DEL command has the following format: DEL wildcard The actual wildcar...
31,073
A Game of Toy Bricks (BRCKGAME) Blue Mary invents a game with toy bricks. The player has N cuboids numbered from 1 to N. The rule of the game is discribed below: Choose some cuboids among the N cuboids, and divide them into M (1 ≤ M ≤ N) piles, named them Pile 1 , Pile 2 ... Pile M . There is at least 1 cuboid ...
31,074
3D Cover (COVER2) In the 3D Cartesian coordinate system, there are n cubes. These cubes are all axis-parallel. What's the volume of the union of these cubes? Input There is a single integer m in the very first line of the input, the number of test cases. m blocks follow. For each test, the first line contains a ...
31,075
01 Sequence (SEQ1) The input consists of exactly 5 test cases in the following format: Input N A0 B0 L0 A1 B1 L1 3 ≤ N ≤ 1000, 1 ≤ A0 ≤ B0 ≤ L0 ≤ N, 1 ≤ A1 ≤ B1 ≤ L1 ≤ N Output Exactly 5 lines, each contains: a) A N-character sequence (We name it S) consisting of only characters '0' and '1' and no extra wh...
31,076
Birthday Cake (CAKE) Adolf wants to send a cake to Blue Mary to celebrate her birthday. The cake looks like a tower which has M floors, each floor is a cylinder. The i-th cylinder counted from downside to upside has a integer height h i and a integer radius r i . These numbers fulfill the following two conditions: ...
31,077
Optimal Connected Subset (OPTSUB) It is well-known that we can uniquely represent any point P on the Cartesian coordinate system using an ordered pair ( x , y ). If both x and y are integers, then we shall call P an integer point, otherwise we shall call P a non-integer point. We shall denote all integer po...
31,078
Memory Distribution (MEMDIS) EMS memory (called memory for short) is some important resource of a computer. When a program is running, the computer must distribute the memory for it. The classical memory distribution process is like the following: The basic unit of the memory is called a cell , each cell is a...
31,079
Program Analyser (ANALYSER) Input A Program which has the following format: <Program>::=<sentence><line break>{<sentence><line break>} <setence>::=<level><space><body> <body>::=<addition> | <output> | <goto> | <condition> | <end> <addition>::=<variable>+<integer> <output>::=<variable>? <goto>::=GO<space><le...
31,080
The Secret of a Lost City (LOSTCT) English Vietnamese Bí mật về thành phố biến mất Nhà khảo cổ nổi tiếng Blue Mary vừa tìm thấy di tích một thành phố bị biến mất. Cô tìm thấy 12 tấm bia lớn ở trung tâm thành phố, mà cô đặt tên là thành phố Đỉnh-Băng (Ice-Peak City). Các tấm bia có nhiều kiến trúc k...
31,081
Help Blue Mary Please! (Act I) (BLUEEQ) This morning Blue Mary wrote some equations on a piece of paper and left it on her desk. After solving some problems in SPOJ, she found that her classmate H.L. replaced all characters on the paper with some other ones. H.L. told her he replaced the same characters with the same ...
31,082
Help Blue Mary Please! (Act II) (BLUEEQ2) Today Mary's math homework is to solve an equation. k 1 x 1 p 1 + k 2 x 2 p 2 + ... + k n x n p n = 0 She knows all k i and p i , and 1 ≤ x i ≤ M. All x i must be integers. She must work out the number of different solutions of this equation this day. Can y...
31,083
The Secret of an Aerolite (AEROLITE) A huge aerolite had fallen in Antarctica!!!Many disasters happened and lots of people lost their lives, homes or even everything.Blue Mary, the well-known scientist, is to work out the secret of this aerolite for further study. Blue Mary has found out that their are some numbers ...
31,084
A Simple Calculator in the Galaxy (GALAXY) Background So if you want to survive the Earth's demise and see the galaxy, make sure you are wearing something more substantial than pajamas and a ratty bathrobe, watch the skies for flying saucers, start worrying when all the dolphins on the planet vanish, and keep your e...
31,085
Greedy Hydra (DRAGON) Hydra is some very greedy animal. A hydra has 9 heads when he is born, and many more new heads will come out when he grows up. Of course, some old heads will break off because of caducity. One day, a hydra with M heads finds a tree with N fruits on it. He is very delighted and wants to eat this...
31,086
Barbarians (BARB) There are N Barbarians living on an unknown island. On the island there are M caves, we can number them 1, 2 ... M clockwise. When we find the island, the barbarians are living in N distinct caves numbered C1, C2 ... CN. Every year each barbarian walks out of his cave and goes along the road, passe...
31,087
Robot Number M (ROBOT) Blue Mary, the well-known astronaut, had sent Robot number 1 to Mars finally. Robot number 1 was so smart that he could make one robot per second. Assume the time Robot number 1 arrived was second 1. At second i, Robot number 1 made a new Robot: Robot number i. (i>=2) The new robots started ...
31,088
Editor II (EDIT3) Background After trying to solve problem EDIT1(Editor) and being ****ed by Brainf**k, Blue Mary decided to set another difficult problem about editor. Description Some definitions: Text: It's a sequence that consists characters whose ASCII code is in [32,126]. Cursor: It's a sign for...
31,089
On the Way to Find Chris (CHRIS) Do you know the famous game THE KING OF FIGHTERS? If the answer is yes, I'm sure you know THE THREE BLACK GROUP: Chris, Shermie and Yashiro. Today Chris is invited to one of his friends' home to play THE KING OF FIGHTERS. Blue Mary is now at Chris' home, she knows where Shermie's and Y...
31,090
Blue Mary Needs Help Again (CASHIER) Blue Mary is a cashier of a big company.The boss of this company is so annoying that he always increases or decreases wage of all workers.He increases all the workers' wage with a same number when he is happy or decreases all the worker's wage with a same number when he is depresse...
31,091
Outside it is now raining (RAIN2) Country M is pluvian. In City P, it rains frequently and many people complain that they always have trouble crossing the streets when raining. To make people cross the streets easier, the government set many "Automatic Umbrellas" above every crosswalk, shown in the picture below. ...
31,092
Another Sequence Problem (SEQ2) You are to write a program to perform some operations on a given sequence. These operations are listed below: +-------------+----------------+------------------------------------------------------------+ | Name | Input format | function ...
31,093
A Game of Pearls (PRLGAME) The game of pearls is to use the following 12 kinds of pearl designs each one and only one time to make the big pearl design.The pearl designs can be rotated and turned over arbitrarily. See the pictures below. The empty grids A sample big p...
31,094
Tom and Jerry (TOMJERRY) You may know the great American cartoon called Tom and Jerry . In that cartoon, Tom is a stupid cat, and Jerry is a cute mouse. They are all living in Blue Mary's house. (Maybe the name of the owner of the house they living in is not Blue Mary, but this is not important. ^_^) One day Jerry ...
31,095
Lemon Tree in the Moonlight (LEMON) Blue Mary extremely like lemon trees. When the softness moon shines the ground, she lies under the lemon tree, thinking about the true meaning of life, the universe and everything quietly. Before long, she is shadowed by the lemon tree. Blue Mary is such a cute girl, that she soon...
31,096
Play with Digit Seven (WORMS) Description A natural number x is called a good number if one or two of the next two conditions is satisfied: 7 is a divisor of x . 7 is a digit of x . Task Write a program that: reads a number n from the standard input, computes the number of good nu...
31,097
Maximum Profit (PROFIT) CS&T, the well-known cellphone company, is going to set some new service stations among n possible ones, which are numbered 1, 2 ... n. The costs of setting these stations are known as P1, P2 ... Pn. Also the company has made a survey among the cellphone users, and now they know that there are ...
31,098
Play with a Tree (PT07A) Hey, ACRush and Jelly are playing a game ! Let take a look at its rule: You are given a tree. Two players take turns cutting edges on a tree. Some nodes is on the "ground". When a player cuts an edge, all the edges that are no longer connected to the ground disappear. The player who can n...
31,099