id
stringlengths
11
14
content
stringlengths
424
1.17M
apps_data_4700
There are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i. There are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j. Obs. i is said to be good when its elevation is higher than those of all observatories that can be re...
apps_data_4701
Square1001 has seen an electric bulletin board displaying the integer 1. He can perform the following operations A and B to change this value: - Operation A: The displayed value is doubled. - Operation B: The displayed value increases by K. Square1001 needs to perform these operations N times in total. Find the minim...
apps_data_4702
Given is an integer x that is greater than or equal to 0, and less than or equal to 1. Output 1 if x is equal to 0, or 0 if x is equal to 1. -----Constraints----- - 0 \leq x \leq 1 - x is an integer -----Input----- Input is given from Standard Input in the following format: x -----Output----- Print 1 if x is equal...
apps_data_4703
You are given a string S consisting of digits between 1 and 9, inclusive. You can insert the letter + into some of the positions (possibly none) between two letters in this string. Here, + must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate a...
apps_data_4704
Snuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it. They will share these cards. First, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards. Here, both Snuke and Raccoon have to take at least one card. Let the ...
apps_data_4705
Snuke has a favorite restaurant. The price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer. So far, Snuke has ordered N meals at the restaurant. Let the amount of money Snuke has paid to the restaurant be...
apps_data_4706
We have a 3×3 square grid, where each square contains a lowercase English letters. The letter in the square at the i-th row from the top and j-th column from the left is c_{ij}. Print the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bott...
apps_data_4707
Snuke has a grid consisting of three squares numbered 1, 2 and 3. In each square, either 0 or 1 is written. The number written in Square i is s_i. Snuke will place a marble on each square that says 1. Find the number of squares on which Snuke will place a marble. -----Constraints----- - Each of s_1, s_2 and s_3 is ei...
apps_data_4708
There is a hotel with the following accommodation fee: - X yen (the currency of Japan) per night, for the first K nights - Y yen per night, for the (K+1)-th and subsequent nights Tak is staying at this hotel for N consecutive nights. Find his total accommodation fee. -----Constraints----- - 1 \leq N, K \leq 10000 ...
apps_data_4709
Joisino wants to evaluate the formula "A op B". Here, A and B are integers, and the binary operator op is either + or -. Your task is to evaluate the formula instead of her. -----Constraints----- - 1≦A,B≦10^9 - op is either + or -. -----Input----- The input is given from Standard Input in the following format: A op...
apps_data_4710
Smeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise. You are given Smeke's current rating, x. Print ABC if Smeke will participate in ABC, and print ARC otherwise. -----Constraints----- - 1 ≦ x ≦ 3{,}000 ...
apps_data_4711
Snuke is buying a bicycle. The bicycle of his choice does not come with a bell, so he has to buy one separately. He has very high awareness of safety, and decides to buy two bells, one for each hand. The store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively. Find the min...
apps_data_4712
You are given a image with a height of H pixels and a width of W pixels. Each pixel is represented by a lowercase English letter. The pixel at the i-th row from the top and j-th column from the left is a_{ij}. Put a box around this image and output the result. The box should consist of # and have a thickness of 1. ---...
apps_data_4713
You have an integer variable x. Initially, x=0. Some person gave you a string S of length N, and using the string you performed the following operation N times. In the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D. Find the maximum value taken by x during the...
apps_data_4714
Find the number of palindromic numbers among the integers between A and B (inclusive). Here, a palindromic number is a positive integer whose string representation in base 10 (without leading zeros) reads the same forward and backward. -----Constraints----- - 10000 \leq A \leq B \leq 99999 - All input values are int...
apps_data_4715
AtCoDeer the deer recently bought three paint cans. The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c. Here, the color of each paint can is represented by an integer between 1 and 100, inclusive. Since he is forgetful, he might...
apps_data_4716
Snuke has N sticks. The length of the i-th stick is l_i. Snuke is making a snake toy by joining K of the sticks together. The length of the toy is represented by the sum of the individual sticks that compose it. Find the maximum possible length of the toy. -----Constraints----- - 1 \leq K \leq N \leq 50 - 1 \leq l_i...
apps_data_4717
Snuke lives at position x on a number line. On this line, there are two stores A and B, respectively at position a and b, that offer food for delivery. Snuke decided to get food delivery from the closer of stores A and B. Find out which store is closer to Snuke's residence. Here, the distance between two points s and t...
apps_data_4718
On some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23. After finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Wr...
apps_data_4719
Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headline...
apps_data_4720
Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? -----Constr...
apps_data_4721
In K-city, there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city? -----Constraints----- - 2 ≤ n, m ≤ 10...
apps_data_4722
Snuke is giving cookies to his three goats. He has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins). Your task is to determine whether Snuke can give cookies to his three goats so that each of them can ...
apps_data_4723
E869120 found a chest which is likely to contain treasure. However, the chest is locked. In order to open it, he needs to enter a string S consisting of lowercase English letters. He also found a string S', which turns out to be the string S with some of its letters (possibly all or none) replaced with ?. One more ...
apps_data_4724
Takahashi is a user of a site that hosts programming contests. When a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows: - Let the current rating of the user be a. - Suppose that the performance of the user in the contest is...
apps_data_4725
For a string of letters, define the Simplicity of the string to be the number of distinct letters in the string. For example, the string string has simplicity $6$, and the string letter has simplicity $4$. You like strings which have simplicity either $1$ or $2$. Your friend has given you a string and you want to turn...
apps_data_4726
ACM-ICPC returns to Singapore in 2015 after a long absence. There may be new contestants from this region who are joining ACM-ICPC for the very first time1. This problem serves as a tutorial for such contestants. First, let establish the fact that the problems posed in ICPC are not research problems where nobody on ea...
apps_data_4727
2048 is a single-player puzzle game created by Gabriele Cirulli1. It is played on a $4 \times 4$ grid that contains integers $\geq 2$ that are powers of 2. The player can use a keyboard arrow key (left/up/right/down) to move all the tiles simultaneously. Tiles slide as far as possible in the chosen direction until they...
apps_data_4728
\[ C_6H_{12}O_{6} + 6O2 \rightarrow 6CO_2 + 6 H_2O \] Professor Cesium has created a new process to transform some chemical product into another type of chemical with some residues. The process is simple: he just needs to input a given number of molecules of type A, enter the output type B he desires and start the mac...
apps_data_4729
Insecure Inc. has decided to shift directions after a failed attempt at developing a new encryption standard. Their new effort is a password system used to hide a password inside another string of characters we denote as a message. However, it is important that the message has a certain property relative to the hidden ...
apps_data_4730
Whenever a programmer starts to learn a Lisp, they think that there are too many parentheses in it. Sophia thinks there are too few, so she is making a programming language with only parentheses. To spice it up a bit, she is also adding square brackets (‘[]’) and curly braces (‘{}’) to the language. Right now, she is ...
apps_data_4731
The Japanese game of Shiritori is the perfect 2-player game for a long car ride. The rules are simple: the first player picks any word to say, then the second player must choose a new word that begins with the last letter of the word that the first player just said. Then it is the first player’s turn again to say a wor...
apps_data_4732
Quite often there is substantial noise in the classroom during class. Instead of paying attention to what the teacher is saying, the students rather discuss the economic crisis or Croatia’s joining the European Union. The biggest noise often occurs when the students are idle, so teachers will give them tasks with a lo...
apps_data_4733
Most of you have played card games (and if you haven’t, why not???) in which the deck of cards is randomized by shuffling it one or more times. A perfect shuffle  is a type of shuffle where the initial deck is divided exactly in half, and the two halves are perfectly interleaved. For example, a deck consisting of eigh...
apps_data_4734
While breaking ground for the Obama Presidential Center, which will be located just a few blocks from campus in Jackson Park, archeologists from the Oriental Institute have made an astounding discovery: a new set of scrolls from the ancient and certainly not made-up Apaxian civilization! It seems that the Apaxian civi...
apps_data_4735
You are an eccentric billionaire with an affinity for sending stuff to Mars. In an ideal world you would send stuff to Mars all the time, but your engineers tell you that it is most efficient to do it when Earth and Mars are somewhat close to each other. Your engineers have calculated that optimal launch windows occu...
apps_data_4736
A bored technician whose job requires inspecting each of $10$ equipment stations on a regular basis has tried to inject a little variety into his days by creating a deck of cards, each card bearing a number in the range $1..10$. From this deck he randomly deals out $K$ cards at the start of the day, and uses the number...
apps_data_4737
ACM (Association for Computing Machinery) organizes the International Collegiate Programming Contest (ICPC) worldwide every year. In the ICPC, a team of three students is presented with a problem set that contains $N$ problems1 of varying types and difficulty levels. The teams are not told which problems are easier (o...
apps_data_4738
Define a $k$-periodic string as follows: A string $s$ is $k$-periodic if the length of the string $|s|$ is a multiple of $k$, and if you chop the string up into $|s|/k$ substrings of length $k$, then each of those substrings (except the first) is the same as the previous substring, but with its last character moved to...
apps_data_4739
Driving through the Irish countryside, one frequently sees enigmatic small grey stones sitting by the wayside, spaced about a kilometre and a half apart. As it turns out, these stones once had a purpose: they were milestones, intended to demarcate this venerable unit of measurement. Being so old and, crucially, collec...
apps_data_4740
In the United States of America, telephone numbers within an area code consist of seven digits: the prefix number is the first three digits and the line number is the last four digits. Traditionally, the $555$ prefix number has been used to provide directory information and assistance as in the following examples: - 5...
apps_data_4741
Yraglac has been a bit bored with Calgary lately and decided to move to the United States. After arriving in the strange land, he discovered that the people there use a temperature scale known as Fahrenheit. Celsius and Fahrenheit are related by the following equation:\[ \left[ ^\circ F \right] = \frac95 \left[ ^\circ ...
apps_data_4742
In the past century, a new style of music composition has emerged. Unlike more traditional methods based on keys and chords, the technique known as dodecaphony focuses on using all twelve notes equally. As a quick reminder, the twelve notes, in ascending order are,\[ C, C\sharp , D, D\sharp , E, F, F\sharp , G, G\sharp...
apps_data_4743
Nimions speak a funny form of language. Whichever word they are trying to say, from which ever language, it doesn’t quite come out the same. There are several rules for converting words, from any language, to nimionese. For any word: - All nimion words start with ‘hard’ consonants (b, c, d, g, k, n, p, t) so you mus...
apps_data_4744
Fidget spinners are so 2017; this year’s rage are fidget cubes. A fidget cube is a cube with unit side lengths, which you hold in your hand and fidget with. Kids these days, right? You work in the planning department for a company that creates and ships fidget cubes. Having done some market analysis, you found that y...
apps_data_4745
After the festive opening of your new store, the Boutique store for Alternative Paramedicine and Cwakhsahlvereigh, to your disappointment you find out that you are not making as many sales as you had hoped. To remedy this, you decide to run a special offer: you will mark some subset of the $n$ items for sale in your st...
apps_data_4746
The Nordic Company of Passing Carriages is losing money at an alarming rate because most of their trains are empty. However, on some lines the passengers are complaining that they cannot fit in the cars and have to wait for the next train! The authorities want to fix this situation. They asked their station masters to...
apps_data_4747
Recently your town has been infested by swindlers who convince unknowing tourists to play a simple dice game with them for money. The game works as follows: given is an $n$-sided die, whose sides have $1, 2, \ldots , n$ pips, and a positive integer $k$. You then roll the die, and then have to make a choice. Option $1$ ...
apps_data_4748
Kim likes building Lego pyramids and now wants to build one of height $H$. How many more bricks are needed if Kim already has $N$ bricks of size $2 \times 2$ and $M$ bricks of size $4 \times 2$? A pyramid is hollow and consists of $H$ layers, as shown in the image. The $k$th layer has width $2k$ for $1\leq k\leq H$. -...
apps_data_4749
You are given an $n$-by-$n$ grid where each square is colored either black or white. A grid is correct if all of the following conditions are satisfied: - Every row has the same number of black squares as it has white squares. - Every column has the same number of black squares as it has white squares. - No row or c...
apps_data_4750
You are given two segments $[l_1; r_1]$ and $[l_2; r_2]$ on the $x$-axis. It is guaranteed that $l_1 < r_1$ and $l_2 < r_2$. Segments may intersect, overlap or even coincide with each other. [Image] The example of two segments on the $x$-axis. Your problem is to find two integers $a$ and $b$ such that $l_1 \le a \le ...
apps_data_4751
Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connected ...
apps_data_4752
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1...
apps_data_4753
Consider a convex polygon with $N$ vertices, with the additional property that no three diagonals intersect in a single point. Find the number of intersections between pairs of diagonals in such a polygon. The figure below shows one such polygon with 6 vertices. Note that a polygon is convex if all of its interior an...
apps_data_4754
Simone’s mother often complains about how Simone never helps with chores at home. In return, Simone often points out that many of the chores her mother assigns her are NP-complete to perform optimally (like cleaning the house, seating her little brothers around the dinner table in a conflict-free way, splitting the bro...
apps_data_4755
Mirko buys a lot of candy in the candy shop. He cannot always pay the exact amount so the shopkeeper and he have an agreement. He tells the shopkeeper the smallest bill he has, and she rounds his amount to the nearest number he can pay. For example, if the smallest bill Mirko has is a hundred bill, and he wants to buy ...
apps_data_4756
It is 1815 and the politicians in Lund have just decided to build a tram line in Lund. Oh, sorry. That was wrong, let’s start over. It is 2015 and the politicians in Lund have just decided to build a tram line in Lund. The politicians have already decided that the tram line should run from south-east to north-west. ...
apps_data_4757
Every evening villagers in a small village gather around a big fire and sing songs. A prominent member of the community is the bard. Every evening, if the bard is present, he sings a brand new song that no villager has heard before, and no other song is sung that night. In the event that the bard is not present, other...
apps_data_4758
Every year, Pumpkin Pete comes up with a couple of different Jack-O’-Lantern ideas for his annual Halloween special. He stacks them up on haystacks for everyone to enjoy and take pictures with. To make sure that there’s a wide variety of displays, he wants to make sure many possible Jack-O’-Lanterns designs are availab...
apps_data_4759
While the Chicago Cubs were ecstatic with their 2016 World Series championship, they were eliminated from the playoffs in 2017. Looking ahead to 2018 they are beginning to embrace the more data-driven analysis of player’s values known as Sabermetrics. For example, a player’s batting average is calculated by dividing t...
apps_data_4760
The sieve of Eratosthenes is a famous algorithm to find all prime numbers up to $N$. The algorithm is: - Write down all integers between 2 and $N$, inclusive. - Find the smallest number not already crossed out and call it $P$; $P$ is prime. - Cross out $P$ and all its multiples that aren’t already crossed out. - If...
apps_data_4761
Your favorite uncle has passed away, leaving you a large estate. Bank account numbers, locations of safe deposit boxes, and GPS coordinates to buried treasures are all locked in an electronic safe in your uncle’s office behind a picture of dogs playing poker. One day he showed you the safe with its $9$ digit keypad (di...
apps_data_4762
Christmas comes sooner every year. In fact, in one oft-forgotten corner of the world, gift-giving has already started in the form of a Secret Santa syndicate. Everybody in the small town of Haircombe is going to put their name into a hat. This hat will be given a hearty shuffle, and then afterwards everybody will take...
apps_data_4763
In a game of darts a player throws darts at a board consisting of 20 different sections labelled $1$ to $20$. When the dart hits section $i$ the player scores $i$ points. Each section also contains a double area and a triple area. When the dart hits the double area of section $i$ the player scores $2 i$ points, and whe...
apps_data_4764
It is Greg’s birthday! To celebrate, his friend Sam invites Greg and two other friends for a small party. Of course, every birthday party must have cake. Sam ordered a square cake. She makes a single horizontal cut and a single vertical cut. In her excitement to eat cake, Sam forgot to make these cuts through the midd...
apps_data_4765
"Perket" is a widely known and delicious meal. For perket to be what it is, cooks must carefully choose the ingredients to get the fullest taste possible while keeping the meal traditional. You have $N$ ingredients at your disposal. For each we know its sourness $S$ and bitterness $B$. When using multiple ingredients,...
apps_data_4766
In the game “Simon Says” one person plays the role of Simon, who gives instructions to everyone else playing the game. The tricky part is that if Simon begins his instruction with “Simon says” then everyone else must follow the instruction (or they lose the game); if Simon gives an instruction that does not begin with ...
apps_data_4767
We’re working on a new super-computer, built to unleash the hidden computing powers of all eight dimensions of reality. The secret to utilizing more dimensions turns out to be to use counting registers of different sizes. In particular, we have eight registers, counting cyclically modulo the different primes $2$, $3$, ...
apps_data_4768
The famous Jurassic park biologist Dean O’Saur has discovered new samples of what he expects to be the DNA of a dinosaur. With the help of his assistant Petra Dactil, he managed to sequence the samples, and now they are ready for analysis. Dean thinks this dinosaur was affected with a particular disease that mutated th...
apps_data_4769
Pero is a passionate lover of riddles. The newest type of riddles he has come across requires the solver to check whether the given word is a multigram. A multigram is a word that consists of concatenating two or more words that are all mutually anagrams. The first of these words is called the root of the multigram. F...
apps_data_4770
Dr. Chaz is hosting a programming contest wrap up dinner. Dr. Chaz has severe OCD and is very strict on rules during dinner, specifically, he needs to be sure that everyone take exactly $1$ piece of chicken at his buffet, even if that will result in an enormous amount of leftovers. This is why every year before the din...
apps_data_4771
It’s that time of the year when students head back to school, which will usually involve moving lots of stuff, and packing lots of that stuff into boxes. However, before we go through that effort, it would be nice to know whether the boxes we have are the right size! A box has three dimensions, $l$, $w$, and $h$, and ...
apps_data_4772
Little Ivica solves crossword puzzles every day. In case you haven’t seen one, a crossword puzzle starts on a grid of $R \times C$ squares, each of which is either empty or blocked. The player’s task is to write words in consecutive empty squares vertically (top down) or horizontally (left to right). Ivica’s sister ha...
apps_data_4773
One of our older Mars Rovers has nearly completed its tour of duty and is awaiting instructions for one last mission to explore the Martian surface. The survey team has picked a route and has entrusted you with the job of transmitting the final set of instructions to the rover. This route is simply a sequence of moves ...
apps_data_4774
The scientists Mildra and Gloisa have been responsible for exploring Luyten 726-8, but have ended up with an issue: Their fusion reactor has stopped working! In order to continue their work, they need to get some materials from the closest asteroid. To do that though, they need to start up the chemical engines, which h...
apps_data_4775
Since ACTA has entered into force, Slavko has been spending his time offline, solving crosswords. Having solved almost all that he could get his hands on, he wants to make a few crosswords of his own. However, he is too sloppy for such fine work, so he has asked you to help him generate the crosswords. You are given t...
apps_data_4776
Do you know what attracts almost any college student to participate in an event? Yes, free food. It doesn’t matter whether the event involves a long (sometimes boring) seminar. As long as free food is served for the event, then students will surely come. Suppose there are $N$ events to be held this year. The $i^\textr...
apps_data_4777
One day, little Mirko came across a funny looking machine! It consisted of a very very large screen and a single button. When he found the machine, the screen displayed only the letter A. After he pressed the button, the letter changed to B. The next few times he pressed the button, the word transformed from B to BA, t...
apps_data_4778
Electoral systems across the world can vary widely. In some systems, such as winner-take-all, the winner is determined by the plurality of votes—the candidate that receives the most votes wins, and the loser(s) do not get a position. Such elections can have “wasted votes.” Conceptually, a wasted vote is a vote that di...
apps_data_4779
The Bureau for Artificial Problems in Competitions wants you to solve the following problem: Given $n$ positive integers $a_1, \dots , a_ n$, what is the maximal value of\[ \left(a_1^2 + \dots + a_ k^2\right) \cdot \left(a_{k+1} + \dots + a_ n\right)? \] -----Input----- - A single line containing an integer $2\leq n\...
apps_data_4780
When moving, ants form rows so that each ant except the first is behind another ant. It is not widely known what happens when two rows of ants moving in opposite directions run into each other in a passage too narrow for both rows to pass through. One theory says that, in that situation, ants will jump over each other....
apps_data_4781
Croatia’s national television programme is broadcasting an entertainment show titled “I Love Croatia”, modeled on the licensed format I love my country. In this show two teams of celebrities and public figures play various games which require knowledge about Croatia. One of the games is Happy Birthday, which will be us...
apps_data_4782
In the kingdom of Winterfield, there are several cities and each pair of cities is connected by exactly one old dirt road. The king of Winterfield has decided that he will upgrade some of those roads. The set of roads that he upgrades must be such that it is possible to get from any city in the kingdom to any other cit...
apps_data_4783
A close friend of yours, a duck with financial problems, has requested your help with a matter that will help him pay off his debts. He is the nephew of an extremely wealthy duck, who has a large vault, filled with mountains of coins. This wealthy duck has a certain coin in his possession which has a lot of sentimental...
apps_data_4784
Pero has negotiated a Very Good data plan with his internet provider. The provider will let Pero use up $X$ megabytes to surf the internet per month. Each megabyte that he doesn’t spend in that month gets transferred to the next month and can still be spent. Of course, Pero can only spend the megabytes he actually has....
apps_data_4785
A known problem with some microphones is the “hissing s”. That is, sometimes the sound of the letter s is particularly pronounced; it stands out from the rest of the word in an unpleasant way. Of particular annoyance are words that contain the letter s twice in a row. Words like amiss, kiss, mississippi and even hiss ...
apps_data_4786
Catherine is a brilliant software engineer, but she has been having difficulty landing a job, despite having submitted a superb resume to dozens of tech companies. After doing some research, she discovered that most tech companies in her area use an algorithm to prescreen resumes by scanning for certain keywords before...
apps_data_4787
Seven Wonders is a card drafting game in which players build structures to earn points. The player who ends with the most points wins. One winning strategy is to focus on building scientific structures. There are three types of scientific structure cards: Tablet (‘T’), Compass (‘C’), and Gear (‘G’). For each type of ca...
apps_data_4788
Jonas is developing the JUxtaPhone and is tasked with animating the compass needle. The API is simple: the compass needle is currently in some direction (between $0$ and $359$ degrees, with north being $0$, east being $90$), and is being animated by giving the degrees to spin it. If the needle is pointing north, and yo...
apps_data_4789
Getting a business permit in Kafkatown requires a trip to City Hall. There you are given a permit form that must be signed by $K$ city clerks whose names are printed at the bottom of the form. Entering the clerks’ room, you find a long line of people working their way down a narrow aisle along the clerks’ desks. Their...
apps_data_4790
A mysterious circular arrangement of black stones and white stones has appeared. Ming has been tasked with balancing the stones so that only one black and one white stone remain. Ming has two operations for balancing the stones: - Take some consecutive sequence of stones where there is exactly one more black stone th...
apps_data_4791
While working a night shift at the university as a janitor, you absentmindedly erase a blackboard covered with equations, only to realize afterwards that these were no ordinary equations! They were the notes of the venerable Professor E. I. N. Stein who earlier in the day solved the elusive maximum quadrilateral proble...
apps_data_4792
The ancient and mysterious Apaxian civilization, which we most certainly did not make up, continues to confound the researchers at the Oriental Institute. It turns out that the Apaxians had a peculiar naming system: the more letters in your name, the higher your status in society. So, in Apaxian society, robert was pro...
apps_data_4793
Peter is expecting a large shipment of fuel oil, but he has a small problem (doesn’t everyone in these programming problems!). The only containers he has are a set of large bottles (each with the same volume) and a set of smaller bottles (also each with the same, but smaller volume). Given the volume of the shipment of...
apps_data_4794
Mirko got his driver’s license! To celebrate that joyous occasion, his parents bought him his first car: a monster truck! Mirko found out that even though having a car that can squash all other cars is nice in traffic jams, parking a car that is the size of $4$ normal cars can be a bit tricky. His friend, Slavko, work...
apps_data_4795
The teacher has sent an e-mail to her students with the following task: “Write a program that will determine and output the value of $X$ if given the statement:\[ X = \mathit{number}_1^{\mathit{pow}_1} + \mathit{number}_2^{\mathit{pow}_2} + \ldots + \mathit{number}_ N^{\mathit{pow}_ N} \] and it holds that $\mathit{nu...
apps_data_4796
Mirko and Slavko bought a few liters of orange, apple and pineapple juice. They are now whipping up a non alcoholic cocktail following a recipe they found on the Internet. Sadly, they figured out too late that not only you should use recipes when making cocktails, you should also use them when planning how much juice t...
apps_data_4797
Shortly before the programming contest started, Bjarki decided to update his computer. He didn’t notice anything strange until he started coding in his favorite editor, Bim (Bjarki IMproved). Usually when he’s writing in an editor and presses the backspace key a single character is erased to the left. But after the upd...
apps_data_4798
Great scientific discoveries are often named by the last names of scientists that made them. For example, the most popular asymmetric cryptography system, RSA was discovered by Rivest, Shamir and Adleman. Another notable example is the Knuth-Morris-Pratt algorithm, named by Knuth, Morris and Pratt. Scientific papers r...
apps_data_4799
Jake is learning how to play the card game Dominion. In Dominion, you can buy a variety of treasure, action, and victory point cards – at the end of the game, the player with the most victory points wins! Each turn, each player draws $5$ cards and can use their action and treasure cards to obtain buying power in order...