Recently Added PCS Online Judge Problemshttps://pcs.org.au/2020-08-20T09:04:05+00:00The latest problems added on the PCS Online Judge websiteRoman Translation2020-08-20T09:04:05+00:002020-08-20T09:04:05+00:00https://pcs.org.au/problem/romantranslator<p>Romeo and Tulio are two Roman thugs that through the power of plot-devices and time-travel have found their way to CS 1.24. On their way to programming greatness, they are having a spat about how to write numbers in this new-fangled Arabic numerals everyone seems to be using nowadays.</p>
<p>Specifically, they have \(n\) numbers they want to translate from our well understood base-10 Arabic numerals to roman numerals. Can you help them write a program to do so?</p>
<p>Romeo and Tulio weren't ...a-index2020-08-14T08:06:03+00:002020-08-14T08:06:03+00:00https://pcs.org.au/problem/aindex<p>David has been developing apps.
To show off the productivity and impact of David's development, David has come up with a metric which David is calling an a-index.</p>
<p>As David is busy developing the next big app, David has gotten you to write a program to calculate an a-index.</p>
<p>An a-index is calculated as the largest integer \(a\) such that the developer has developed \(a\) applications that each have at least \(a\) users.</p>
<p>Given the number of users on each app that a developer...Morning Traffic Lights2020-07-20T09:02:25+00:002020-07-20T09:02:25+00:00https://pcs.org.au/problem/morningtraffic<p>Finally, semester two is starting and you are keen to get to the library to study!
You decide to drive to campus but you hate getting stuck in traffic.</p>
<p>Your route is \(D\) kilometres with \(N\) traffic lights. Each light is either red or green (at least as far as you are concerned). You may pass through a green light but not a red light. Amazingly, when you leave home all the lights are red. Each light will turn green for the first time after \(a\) minutes. Then, the light will remain ...Make an Anagram2020-07-18T05:29:09+00:002020-07-18T05:29:09+00:00https://pcs.org.au/problem/makeanagram<p>Nic tends to confuse people with anagrams, not intentionally, but sometimes he gets his words mixed up. Two strings are anagrams of each other if the letters of the first string can be arranged to form the second string. For example, <code>bad credit</code> and <code>debit card</code> are anagrams.</p>
<p>You, a concerned observer of Nic, wonder how many characters need to be deleted from one of two string Nic has uttered to make them anagrams. Can you compute this number?</p>
<p>More formall...Alden's Lazer Gun2020-05-15T05:40:29+00:002020-05-15T05:40:29+00:00https://pcs.org.au/problem/aldenlazergun<p>Alden is stuck in the middle of an old-fashioned zombie apocalypse. More specifically, Alden is stuck in the middle of Cameron Hall (or what is left of it since it is now an infinite plane). Each zombie is described with two coordinates \((x,y)\) on this plane.</p>
<p>Fortunately (for Alden), he has a latest duel-direction lazer gun. He stands at the point \((x_0, y_0)\) and in one shot it can destroy anything situated on some line crossing this point \((x_0, y_0)\).</p>
<p>Your task is to de...Broken Keyboard2020-05-14T08:20:10+00:002020-05-14T08:20:10+00:00https://pcs.org.au/problem/brokenkeyboard<p>I have received an email from James but I know his keyboard is broken so pressing a key once may cause the corresponding symbol to appear more than once.</p>
<p>For example, after typing 'help', the following words <em>could</em> be printed: 'help', 'hhhelp', 'hheelp', 'hellllp' but the following <em>could not</em> be printed: 'hell', 'elp' and 'hllpp'.</p>
<p>Note that when you press a key, the corresponding symbol must appear (at least once). James' keyboard is so thoroughly broken that pre...Lunch Choice2020-05-14T04:43:14+00:002020-05-14T04:43:14+00:00https://pcs.org.au/problem/lunchchoice<p>While furiously programming the donation site for the Cameron Hall 2020 Charity UnVigil (<a href="https://charityunvigil.online/" rel="nofollow">https://charityunvigil.online/</a>) James and Felix decide to have a lunch break. Being extremely hard workers they give themselves exactly \(k\) units of time to have lunch.</p>
<p>They have a list of \(n\) venues. The \(i\)-th venue is characterized by two integers \(f_i\) and \(t_i\). \(t_i\) is the time needed to lunch at the \(i\)-th venue. If \...Unlocking the Machine Room2020-05-14T01:33:38+00:002020-05-14T01:33:38+00:00https://pcs.org.au/problem/unlockmachineroom<p>In an effort to make access to the UCC machine room more accessible than ever James has installed a new voice-activated lock on its door. <em>The Backstreet Boys' Reunion Tour</em> has hit this year's budget and so the installed lock can only recognize a password two English letters in length.</p>
<p>The Cameron Hall pet goose (Gozz) wants access to the machine room and steal some sensible information because sometimes geese be like that. Gozz can honk several (not necessarily distinct) two-l...Restoring Numbers2020-05-13T11:15:16+00:002020-05-13T11:15:16+00:00https://pcs.org.au/problem/restorethreenums<p>James has thought of three positive integers \(a, b\) and \(c\) to use as a secret pin for the UCC vending machine. He then writes down their pairwise sums and total sum in arbitrary order on the clubroom whiteboard. So, there are four numbers on the whiteboard \(a + b, a + c, b + c\) and \(a + b + c\) in a random order.</p>
<p>You, wanting unlimited snacks and beverages long to find \(a, b\) and \(c\). Print them in ascending order.</p>
<p>Note that it is possible for any of these numbers to...Rock-Paper-Scissors2020-05-13T09:00:00+00:002020-05-13T09:00:00+00:00https://pcs.org.au/problem/rockpapersciss<p>Uncle Alden, cousin David, Seamus the cat and Tom the doggo live a simple yet happy life in Cameron Hall. Sometimes the gang receive parcels from David's parents and sometimes from other generous donors. The Colemak keyboard is clearly for Tom; a 3D-printer is for David, a whiteboard would be for Alden and fish would be for Seamus. But for whom was a new game console meant? All four of them quarrelled, but wise Alden had an idea to settle the dispute; play a version of paper-scissors-rock to ...Odds and Ends2020-05-13T09:00:00+00:002020-05-13T09:00:00+00:00https://pcs.org.au/problem/oddends<p>Mitchell is a keen fan of absurd comedy, eccentricity and is generally displeased with a great many things. In particular, Mitchell is disgusted by the order of natural numbers (positive integers) and would like to rearrange them. There are too many natural numbers to do this in one move so Mitchell starts with the first \(n\). He writes down the following sequence: all even integers from \(2\) to \(n\) (ascending), then all odd integers from \(1\) to \(n\) (descending). Help Mitchell, the la...Isolation Game2020-05-13T09:00:00+00:002020-05-13T09:00:00+00:00https://pcs.org.au/problem/isogame<p>After <em>The Backstreet Boys' Reunion Tour</em> plunged humanity into global lockdown and after consuming all Star Trek related content Gozz and Taylor decide to play a game to pass the time. Gozz and Taylor receive a number each <em>a</em> and <em>b</em> respectively. They also have a heap of <em>n</em> stones. The players take turns with Taylor (the second player) starting. During a move, a player should take from the heap the number of stones equal to the greatest common divisor of the fi...Divisible Library2020-05-12T16:42:04+00:002020-05-12T16:42:04+00:00https://pcs.org.au/problem/divisiblelibrary<p>David is a librarian and a keen mathematician. He has a special way of arranging the books.<br>
Every day David takes all \(n\) books labelled \(1-n\) and arranges them in some permutation.<br>
He creates a sequence \(g\) where every \(g_i\) represents the Greatest Common Divisor (GCD) of the labels of all the books in the permutation from index \(1\) to index \(i\).<br>
He's picky about what permutations are ok and limits them to permutations where the number of unique elements of the sequen...Tell Me the Odds2020-05-12T07:00:11+00:002020-05-12T07:00:11+00:00https://pcs.org.au/problem/tellmeodds<p>Alden is playing an RPG: Blades in the Dark.
Having not rolled a full success on numerous consecutive rolls, Alden would like to know the odds rolling a full success.</p>
<p>A roll, consisting of \(d\) dice, is a full success if at least one dice lands on the highest value face.</p>
<p>Alden has tested that each dice has the same number of sides, that each dice has exactly one highest value face, and that each dice has an equal chance of landing on each face.</p>
<p>Having a limited memory an...UnVigil II: The Squeakquel2020-05-08T02:46:33+00:002020-05-08T02:46:33+00:00https://pcs.org.au/problem/unvigil2<p>One of the few things we know with certainty is that the next Charity UnVigil will be held exactly \(n\) months in the future. You look at the calendar and notice the current month \(s\). How can you know what month the next Charity UnVigil will be held in?</p>
<p>All 13 months in the Calendar are named as <code>January, February, March, April, May, June, July, August, September, Spooktober, November, December, January2</code>.</p>
<h4>Input Specification</h4>
<p>Two lines. The first will con...Query In A Query2020-03-16T01:40:25+00:002020-03-16T01:40:25+00:00https://pcs.org.au/problem/queryinaquery<h3>Query In A Query</h3>
<p>Alden some permutation \(a\) of the numbers \(1\) to \(n\). He's very familiar with some properties of this permutation, to the extent that simple range queries are a trivial problem to him. However, he ponders the idea of a range query containing a similar query. Alden thinks to himself, if he defined a function \(g\) such that \(g(l, r)\) gives the index of the maximum in \(a\) in the range \(l\) to \(r\), and then defines another function \(f\) such that \(f(l, r...Particular Particles2020-03-03T16:39:20+00:002020-03-03T16:39:20+00:00https://pcs.org.au/problem/particularparticles<h3>Particular Particles</h3>
<p>Lauren is conducting an experiment to test an apparatus. She expects the black box to perform in the following way. Given \(n\) particles of \(k\) types, the box will act on the particles at each step such that \(k-1\) particles are selected, all of differing types. These particles are then transformed into the remaining type of particle. Lauren wants to know in how many combinations of particles are possible for her to observe. As this answer can be very large i...A squared plus B squared2020-03-03T15:44:59+00:002020-03-03T15:44:59+00:00https://pcs.org.au/problem/asquaredplusbsquared<h3>A squared plus B squared</h3>
<p>Albert is an enthusiastic mathematician. He states that he knows all pythagorean triples that use the numbers from 1 to 1000. Naturally you feel obligated to one up Albert and wish to create a program that given any non-negative integer \(c\) you can find two non-negative integers \(a\) and \(b\) such that \(a^2 + b^2 = c\) if two such integers exist</p>
<h4>Input Specification</h4>
<p>The first line contains one integer \(c\)</p>
<h4>Output Specification</h4...Array Rotation2020-03-03T14:25:01+00:002020-03-03T14:25:01+00:00https://pcs.org.au/problem/arrayrotation<h3>Array Rotation</h3>
<p>Nick is just starting out his CS course at UWA. His first project involves
going through a list of \(n\) numbers with the index corresponding to a clockwise rotation on a circle. Nick finds that if he at first rotates this mapping by \(k\) indices clockwise, his project is much more efficient. Help nick determine what this list would look like</p>
<h4>Input Specification</h4>
<p>The first line contains two integers \(n\) and \(k\)
the next line will contain \(n\) spac...Crazy Typist2020-03-03T07:53:38+00:002020-03-03T07:53:38+00:00https://pcs.org.au/problem/crazytypist<h3>Crazy Typist</h3>
<p>David is an avid typist. Unfortunately with how fast he moves his fingers he can often type duplicate characters by mistake. Given a string \(s\) of length \(n\) find the string david meant to type. It is safe to assume that any duplicate character is a mistake</p>
<h4>Input Specification</h4>
<p>The first line contains one integer \(n\)<br>
The next line will contain a string of \(n\) characters</p>
<h4>Output Specification</h4>
<p>Output the correct string on a single ...Multiples2018-08-13T02:46:19+00:002018-08-13T02:46:19+00:00https://pcs.org.au/problem/multiples<p>Imagine you are still a lowly high-school student (apologies to the lowly high-school students competing). You are bored in maths class (purely hypothetically). To amuse yourself, you are playing a game. The games works as follows. You want to find the largest non-negative multiple of a positive integer \(X\) such that the number of digits (in base 10) is exactly \(D\). Several of your friends have started playing. So you can shame them and their families, you have decided to write a program ...Uneven Sand2018-07-01T05:09:23+00:002018-07-01T05:09:23+00:00https://pcs.org.au/problem/unevensand<p>Having just landed in the desert Kira remembers that his Strike Gundam is not yet programmed for sand environments. He needs to determine the right amount of pressure \(N\) that the Strike needs to exert on the sand so that it will neither sink nor float. In other words, he needs the pressure to be an exact number. He knows that the maximum pressure that needs to be exerted is \(2×10^9\) and the minimum pressure is \(1\). He wants to find this number \(N\) in at most 31 guesses.</p>
<h4>Inter...Colouring Trees2018-03-31T11:25:49+00:002018-03-31T11:25:49+00:00https://pcs.org.au/problem/coltrees<p>Nick has found a very odd looking tree. It seems to have 3 different coloured nodes, cyan (<code>C</code>), yellow (<code>Y</code>) and red (<code>R</code>), where each node is connected to any number of other nodes. Unfortunately, Nick cannot see all the nodes of the tree, as some of them are hidden from view, so he wants to know the number of ways that the hidden nodes could be coloured and the tree remain "coloured".</p>
<p>The tree is considered coloured if no two connected nodes are the ...Bear Chess2018-03-31T10:13:24+00:002018-03-31T10:13:24+00:00https://pcs.org.au/problem/bearchess<p>Yogi "Gozz" Bear, being smarter than the average bear, is attempting to develop his own unique take on chess. Although, still being a bear, he only has access to a checkerboard pic-a-nic blanket with \(R\) rows, and \(C\) columns, and his pristine collection of stolen rooks (castles).</p>
<p>Gozz wishes to find the ideal starting position for his game, such that he can place as many rooks as possible onto the checkerboard blanket without allowing any two pieces to attack each other directly.<...Purple Lights2018-03-30T22:43:28+00:002018-03-30T22:43:28+00:00https://pcs.org.au/problem/purplelights<p>Historically, the colour purple has been associated with royalty, magic, eggplants and a rather suspicious dinosaur whose name rhymes with 'arnie'. Mark, in anticipation of fulfilling his dream of ruling the galaxy for the next millennium is throwing the most purple party possible to reflect his royal-magic.</p>
<p>Mark in his haste to throw the galaxy's best gathering hastily ordered 'purple-range' lights. When they arrived, they turned out to be rather peculiar bulbs indeed. Instead of bein...