question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. There are n cities in Berland. Each city has its index β€” an integer number from 1 to n. The capital has index r1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital to each city, i.e. the road m...
Solve the programming task below in a Python markdown code block. Every year a race takes place on the motorway between cities A and B. This year Vanya decided to take part in the race and drive his own car that has been around and bears its own noble name β€” The Huff-puffer. So, Vasya leaves city A on the Huff-puffer...
Solve the programming task below in a Python markdown code block. The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper. To make sure that the number a fits on the piece of paper, the Little Elephant ought to delete exactly one any digit from number a ...
Solve the programming task below in a Python markdown code block. Even if the world is full of counterfeits, I still regard it as wonderful. Pile up herbs and incense, and arise again from the flames and ashes of its predecessorΒ β€” as is known to many, the phoenix does it like this. The phoenix has a rather long life...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese and Russian as well. In every contest there should be an easy problem about matrices. December Cook-Off is not an exception. Given a matrix A which consists of n rows and m columns, and contains integer nu...
Solve the programming task below in a Python markdown code block. There are $n$ boxers, the weight of the $i$-th boxer is $a_i$. Each of them can change the weight by no more than $1$ before the competition (the weight cannot become equal to zero, that is, it must remain positive). Weight is always an integer number. ...
Solve the programming task below in a Python markdown code block. Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integersΒ β€” amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost. Eff...
Solve the programming task below in a Python markdown code block. Having bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has n rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height of the walls in meters (different...
Solve the programming task below in a Python markdown code block. To decide which is the strongest among Rock, Paper, and Scissors, we will hold an RPS tournament. There are 2^k players in this tournament, numbered 0 through 2^k-1. Each player has his/her favorite hand, which he/she will use in every match. A string s...
Solve the programming task below in a Python markdown code block. Consider the following well known rules: - A number is divisible by 3 if the sum of its digits is divisible by 3. Let's call '3' a "1-sum" prime - For 37, we take numbers in groups of threes from the right and check if the sum of these groups is divisi...
Solve the programming task below in a Python markdown code block. You are given a sequence A, where its elements are either in the form + x or -, where x is an integer. For such a sequence S where its elements are either in the form + x or -, define f(S) as follows: * iterate through S's elements from the first on...
Solve the programming task below in a Python markdown code block. Manao is taking part in a quiz. The quiz consists of n consecutive questions. A correct answer gives one point to the player. The game also has a counter of consecutive correct answers. When the player answers a question correctly, the number on this co...
Solve the programming task below in a Python markdown code block. C: Skewering problem One day, when Homura was playing with blocks, Tempura came. Homura decided to play with blocks with Tempura. There is a rectangular parallelepiped of A \ times B \ times C, which is made by stacking A \ times B \ times C blocks o...
Solve the programming task below in a Python markdown code block. ## Your story You've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sale and saw an ornate cuckoo clock with a missing pendulum, and a "Beyond-Ultimate Raspberry Pi Starter Kit" filled with all sorts of sensors and ...
Solve the programming task below in a Python markdown code block. Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of $n$ consecutive tiles, numbered from $1$ to $n$. Ujan will paint each tile in some colo...
Solve the programming task below in a Python markdown code block. Lots of geeky customers visit our chef's restaurant everyday. So, when asked to fill the feedback form, these customers represent the feedback using a binary string (i.e a string that contains only characters '0' and '1'. Now since chef is not that gr...
Solve the programming task below in a Python markdown code block. At the end of last year, Santa Claus forgot to give Christmas presents to the children in JOI village. Therefore, I decided to deliver the chocolate cake to the children as an apology. The day to deliver is approaching tomorrow, so it's time to come up ...
Solve the programming task below in a Python markdown code block. A [Power Law](https://en.wikipedia.org/wiki/Power_law) distribution occurs whenever "a relative change in one quantity results in a proportional relative change in the other quantity." For example, if *y* = 120 when *x* = 1 and *y* = 60 when *x* = 2 (i....
Solve the programming task below in a Python markdown code block. As we all know, F.C. Barcelona is the best soccer team of our era! Their entangling and mesmerizing game style usually translates into very high ball possession, consecutive counter-attack plays and goals. Lots of goals, thanks to the natural talent of ...
Solve the programming task below in a Python markdown code block. Limak is a little polar bear. He has n balls, the i-th ball has size t_{i}. Limak wants to give one ball to each of his three friends. Giving gifts isn't easyΒ β€” there are two rules Limak must obey to make friends happy: No two friends can get balls of...
Solve the programming task below in a Python markdown code block. In this Kata, you will be given an array and your task will be to determine if an array is in ascending or descending order and if it is rotated or not. Consider the array `[1,2,3,4,5,7,12]`. This array is sorted in `Ascending` order. If we rotate thi...
Solve the programming task below in a Python markdown code block. There are two towers consisting of blocks of two colors: red and blue. Both towers are represented by strings of characters B and/or R denoting the order of blocks in them from the bottom to the top, where B corresponds to a blue block, and R correspond...
Solve the programming task below in a Python markdown code block. Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off. The buildi...
Solve the programming task below in a Python markdown code block. There are an integer sequence A_1,...,A_N consisting of N terms, and N buttons. When the i-th (1 ≦ i ≦ N) button is pressed, the values of the i terms from the first through the i-th are all incremented by 1. There is also another integer sequence B_1,...
Solve the programming task below in a Python markdown code block. Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees. Consider the point (x, y) in the 2D plane such that x and y are integers and 0 ≀ x, y. There is a tree in such a point, and ...
Solve the programming task below in a Python markdown code block. It's Galactik Football time! The Galactik Football Assosiation (GFA) has announced a football tournament between all the teams of all the planets in the galaxy. Each planet of the galaxy has a government. Some governments have a mutual agreement betwee...
Solve the programming task below in a Python markdown code block. When you enter 8 numbers from 0 to 9, write a program that outputs the difference between the largest integer and the smallest integer that can sort the 8 numbers. The number that can be sorted may start from 0, such as 00135569. Input Given multipl...
Solve the programming task below in a Python markdown code block. A dice is a cube, its faces contain distinct integers from 1 to 6 as black points. The sum of numbers at the opposite dice faces always equals 7. Please note that there are only two dice (these dices are mirror of each other) that satisfy the given cons...
Solve the programming task below in a Python markdown code block. Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or vertical direc...
Solve the programming task below in a Python markdown code block. Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so each fountain cost can be either...
Solve the programming task below in a Python markdown code block. Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome world, where everything is of the same color and only saturation differs. This pack can be represented as a sequence a_1, a_2, ..., a_{n} of n intege...
Solve the programming task below in a Python markdown code block. You are given an array a. Some element of this array a_{i} is a local minimum iff it is strictly less than both of its neighbours (that is, a_{i} < a_{i} - 1 and a_{i} < a_{i} + 1). Also the element can be called local maximum iff it is strictly greater...
Solve the programming task below in a Python markdown code block. You are playing one famous sandbox game with the three-dimensional world. The map of the world can be represented as a matrix of size n Γ— m, where the height of the cell (i, j) is a_{i, j}. You are in the cell (1, 1) right now and want to get in the ce...
Solve the programming task below in a Python markdown code block. Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible. Omkar currently has $n$ supports arranged in a line, the $i$-th of which has height $a_i$. Omkar wants to build his waterslid...
Solve the programming task below in a Python markdown code block. It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such that i-th pile contains a_{i} worms. He labeled all these worms with consecutive integers: worms in first pile are labe...
Solve the programming task below in a Python markdown code block. Ashish has a tree consisting of $n$ nodes numbered $1$ to $n$ rooted at node $1$. The $i$-th node in the tree has a cost $a_i$, and binary digit $b_i$ is written in it. He wants to have binary digit $c_i$ written in the $i$-th node in the end. To achie...
Solve the programming task below in a Python markdown code block. Your job is to change the given string `s` using a non-negative integer `n`. Each bit in `n` will specify whether or not to swap the case for each alphabetic character in `s`: if the bit is `1`, swap the case; if its `0`, leave it as is. When you finis...
Solve the programming task below in a Python markdown code block. Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions. To ensure the security, you have to build some police checkposts. Checkposts can only be built in ...
Solve the programming task below in a Python markdown code block. Read the coordinates of four different points on the plane, $ A (x_A, y_A) $, $ B (x_B, y_B) $, $ C (x_C, y_C) $, $ D (x_D, y_D) $, and straight line $ Create a program that outputs YES if AB $ and $ CD $ are orthogonal, and NO if they are not orthogona...
Solve the programming task below in a Python markdown code block. Snuke has a string s. From this string, Anuke, Bnuke, and Cnuke obtained strings a, b, and c, respectively, as follows: * Choose a non-empty (contiguous) substring of s (possibly s itself). Then, replace some characters (possibly all or none) in it wit...
Solve the programming task below in a Python markdown code block. Problem A: Swap crypto A 2D enthusiast at R University, he often writes embarrassing sentences that blush when seen by people. Therefore, in order for a third party to not be able to see the text he is writing, he encrypts the text using a method calle...
Solve the programming task below in a Python markdown code block. Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden lo...
Solve the programming task below in a Python markdown code block. You know combinations: for example, if you take 5 cards from a 52 cards deck you have 2,598,960 different combinations. In mathematics the number of x combinations you can take from a set of n elements is called the binomial coefficient of n and x, or...
Solve the programming task below in a Python markdown code block. problem There are the following two-player card games. * This game uses a total of 2n cards with each integer from 1 to 2n written on it. Here, n is an integer between 1 and 100. * Deal n cards to each of the two. * Put cards into play alternately one...
Solve the programming task below in a Python markdown code block. # Scenario **_Several people_** are standing in *a row divided into two teams*. The **_first person_** goes into **_team 1_**, **_the second_** goes into **_team 2_**, **_the third_** goes into **_team 1_**, and so on. ___ # Task **_Given_** *an arr...
Solve the programming task below in a Python markdown code block. Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, its length is l centime...
Solve the programming task below in a Python markdown code block. Have you ever played Hanabi? If not, then you've got to try it out! This problem deals with a simplified version of the game. Overall, the game has 25 types of cards (5 distinct colors and 5 distinct values). Borya is holding n cards. The game is somew...
Solve the programming task below in a Python markdown code block. Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform n operations. Each operation is one of the following: Add the integer x_{i} to the first a_{i} elements o...
Solve the programming task below in a Python markdown code block. Welcome to PC Koshien, players. At PC Koshien, competitions are currently being held in a total of three categories: programming category, mobile category, and Ichimai's picture CG category. Given the number of participants in each department, create a...
Solve the programming task below in a Python markdown code block. Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a gi...
Solve the programming task below in a Python markdown code block. Given is a string S, where each character is `0`, `1`, or `?`. Consider making a string S' by replacing each occurrence of `?` with `0` or `1` (we can choose the character for each `?` independently). Let us define the unbalancedness of S' as follows: ...
Solve the programming task below in a Python markdown code block. You are given N points on a plane. Write a program which will find the sum of squares of distances between all pairs of points. Input The first line of input contains one integer number N (1 ≀ N ≀ 100 000) β€” the number of points. Each of the following...
Solve the programming task below in a Python markdown code block. Implement `String#to_cents`, which should parse prices expressed as `$1.23` and return number of cents, or in case of bad format return `nil`. Read the inputs from stdin solve the problem and write the answer to stdout (do not directly test on the samp...
Solve the programming task below in a Python markdown code block. Let's call a sequence $b_1, b_2, b_3 \dots, b_{k - 1}, b_k$ almost increasing if $$\min(b_1, b_2) \le \min(b_2, b_3) \le \dots \le \min(b_{k - 1}, b_k).$$ In particular, any sequence with no more than two elements is almost increasing. You are given a ...
Solve the programming task below in a Python markdown code block. Many years ago Berland was a small country where only $n$ people lived. Each person had some savings: the $i$-th one had $a_i$ burles. The government considered a person as wealthy if he had at least $x$ burles. To increase the number of wealthy people...
Solve the programming task below in a Python markdown code block. A subsequence of length |x| of string s = s1s2... s|s| (where |s| is the length of string s) is a string x = sk1sk2... sk|x| (1 ≀ k1 < k2 < ... < k|x| ≀ |s|). You've got two strings β€” s and t. Let's consider all subsequences of string s, coinciding wit...
Solve the programming task below in a Python markdown code block. Lord Omkar would like to have a tree with n nodes (3 ≀ n ≀ 10^5) and has asked his disciples to construct the tree. However, Lord Omkar has created m (1 ≀ m < n) restrictions to ensure that the tree will be as heavenly as possible. A tree with n nodes...
Solve the programming task below in a Python markdown code block. Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them. He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he ...
Solve the programming task below in a Python markdown code block. You are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K. The order of a,b,c does matter, and some of them can be the same. -----Constraints----- - 1 \l...
Solve the programming task below in a Python markdown code block. Vasily has a number a, which he wants to turn into a number b. For this purpose, he can do two types of operations: multiply the current number by 2 (that is, replace the number x by 2Β·x); append the digit 1 to the right of current number (that is, re...
Solve the programming task below in a Python markdown code block. <image> Input The input contains two integers a, b (1 ≀ a ≀ 10, 0 ≀ b ≀ 22Β·a - 1) separated by a single space. Output Output two integers separated by a single space. Examples Input 1 0 Output 0 0 Input 2 15 Output 3 0 Input 4 160 O...
Solve the programming task below in a Python markdown code block. The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil"). However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travell...
Solve the programming task below in a Python markdown code block. You are given a string s consisting of `A`, `B` and `C`. Snuke wants to perform the following operation on s as many times as possible: * Choose a contiguous substring of s that reads `ABC` and replace it with `BCA`. Find the maximum possible numbe...
Solve the programming task below in a Python markdown code block. Polycarpus is the director of a large corporation. There are n secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each other via Spyke, the Spyke network a...
Solve the programming task below in a Python markdown code block. While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is broken. When he tries to compute $1 + 3$ using the calculator, he gets $2$ instead of $4$. But when he tries computing $1 + 4$, he gets ...
Solve the programming task below in a Python markdown code block. Lately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia. The game is played by two people taking turns, where Mr. Chanek take...
Solve the programming task below in a Python markdown code block. Nezzar has a binary string s of length n that he wants to share with his best friend, Nanako. Nanako will spend q days inspecting the binary string. At the same time, Nezzar wants to change the string s into string f during these q days, because it look...
Solve the programming task below in a Python markdown code block. You are given a sequence a_1, a_2, ..., a_n, consisting of integers. You can apply the following operation to this sequence: choose some integer x and move all elements equal to x either to the beginning, or to the end of a. Note that you have to move ...
Solve the programming task below in a Python markdown code block. For a positive integer n, let us define f(n) as the number of digits in base 10. You are given an integer S. Count the number of the pairs of positive integers (l, r) (l \leq r) such that f(l) + f(l + 1) + ... + f(r) = S, and find the count modulo 10^9 ...
Solve the programming task below in a Python markdown code block. You are given a chessboard consisting of $n$ rows and $n$ columns. Rows are numbered from bottom to top from $1$ to $n$. Columns are numbered from left to right from $1$ to $n$. The cell at the intersection of the $x$-th column and the $y$-th row is den...
Solve the programming task below in a Python markdown code block. Please notice the unusual memory limit of this problem. Orac likes games. Recently he came up with the new game, "Game of Life". You should play this game on a black and white grid with $n$ rows and $m$ columns. Each cell is either black or white. Fo...
Solve the programming task below in a Python markdown code block. There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your friend for t...
Solve the programming task below in a Python markdown code block. Amugae has a hotel consisting of $10$ rooms. The rooms are numbered from $0$ to $9$ from left to right. The hotel has two entrances β€” one from the left end, and another from the right end. When a customer arrives to the hotel through the left entrance,...
Solve the programming task below in a Python markdown code block. The Menger Sponge is a three-dimensional fractal, first described by Karl Menger in 1926. ![Mengers Sponge (Level 0-3)](http://i.imgur.com/V6Rb4Za.jpg) ###### _An illustration of the iterative construction of a Menger sponge_ A method of constructing ...
Solve the programming task below in a Python markdown code block. One day Squidward, Spongebob and Patrick decided to go to the beach. Unfortunately, the weather was bad, so the friends were unable to ride waves. However, they decided to spent their time building sand castles. At the end of the day there were n castl...
Solve the programming task below in a Python markdown code block. Problem H: Squid Multiplication Squid Eiko loves mathematics. Especially she loves to think about integer. One day, Eiko found a math problem from a website. "A sequence b ={ai + aj | i < j } is generated from a sequence a ={a0 , ... , an | ai is even...
Solve the programming task below in a Python markdown code block. This is a story of a world somewhere far from the earth. In this world, the land is parted into a number of countries ruled by empires. This world is not very peaceful: they have been involved in army race. They are competing in production of missiles ...
Solve the programming task below in a Python markdown code block. Because of budget cuts one IT company established new non-financial reward system instead of bonuses. Two kinds of actions are rewarded: fixing critical bugs and suggesting new interesting features. A man who fixed a critical bug gets "I fixed a critic...
Solve the programming task below in a Python markdown code block. Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind. Roma has a choice to buy exactly one of n different weapons and exactly one of m different armor sets. Weapon i has attac...
Solve the programming task below in a Python markdown code block. We guessed some integer number $x$. You are given a list of almost all its divisors. Almost all means that there are all divisors except $1$ and $x$ in the list. Your task is to find the minimum possible integer $x$ that can be the guessed number, or s...
Solve the programming task below in a Python markdown code block. According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most d centimeters. Captain Bob has n soldiers in his detachment...
Solve the programming task below in a Python markdown code block. Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: - f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x...
Solve the programming task below in a Python markdown code block. Alyona's mother wants to present an array of n non-negative integers to Alyona. The array should be special. Alyona is a capricious girl so after she gets the array, she inspects m of its subarrays. Subarray is a set of some subsequent elements of the...
Solve the programming task below in a Python markdown code block. Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the objects consecutiv...
Solve the programming task below in a Python markdown code block. There is a square painted on a piece of paper, the square's side equals n meters. John Doe draws crosses on the square's perimeter. John paints the first cross in the lower left corner of the square. Then John moves along the square's perimeter in the c...
Solve the programming task below in a Python markdown code block. [INSPION FullBand Master - INSPION](https://www.youtube.com/watch?v=kwsciXm_7sA) [INSPION - IOLITE-SUNSTONE](https://www.youtube.com/watch?v=kwsciXm_7sA) On another floor of the A.R.C. Markland-N, the young man Simon "Xenon" Jackson, takes a break aft...
Solve the programming task below in a Python markdown code block. You are given an array $a$ of $n$ integers and an integer $s$. It is guaranteed that $n$ is odd. In one operation you can either increase or decrease any single element by one. Calculate the minimum number of operations required to make the median of t...
Solve the programming task below in a Python markdown code block. For a given weighted graph $G = (V, E)$, find the shortest path from a source to each vertex. For each vertex $u$, print the total weight of edges on the shortest path from vertex $0$ to $u$. Constraints * $1 \leq n \leq 10,000$ * $0 \leq c_i \leq 100...
Solve the programming task below in a Python markdown code block. Dima is a beginner programmer. During his working process, he regularly has to repeat the following operation again and again: to remove every second element from the array. One day he has been bored with easy solutions of this problem, and he has come ...
Solve the programming task below in a Python markdown code block. Given is a three-digit integer N. Does N contain the digit 7? If so, print Yes; otherwise, print No. -----Constraints----- - 100 \leq N \leq 999 -----Input----- Input is given from Standard Input in the following format: N -----Output----- If N cont...
Solve the programming task below in a Python markdown code block. You are given two binary strings $x$ and $y$, which are binary representations of some two integers (let's denote these integers as $f(x)$ and $f(y)$). You can choose any integer $k \ge 0$, calculate the expression $s_k = f(x) + f(y) \cdot 2^k$ and writ...
Solve the programming task below in a Python markdown code block. You are given an image, that can be represented with a 2-d n by m grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like to compress this image. You want to choose an integer k > 1...
Solve the programming task below in a Python markdown code block. Let's assume that v(n) is the largest prime number, that does not exceed n; u(n) is the smallest prime number strictly greater than n. Find $\sum_{i = 2}^{n} \frac{1}{v(i) u(i)}$. -----Input----- The first line contains integer tΒ (1 ≀ t ≀ 500) ...
Solve the programming task below in a Python markdown code block. There is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet β€” the memory manager is among them. According to the developers' plan, in the first release the memory manager will b...
Solve the programming task below in a Python markdown code block. A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are: `2332, 110011, 54322345` For a given number ```num```, write a function which returns an array of a...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Arrays have fallen out of Chef's good books, and he plans to destroy all arrays he possesses. He is left with the last array A, consisting of N positive integers. In order ...
Solve the programming task below in a Python markdown code block. Thanos sort is a supervillain sorting algorithm, which works as follows: if the array is not sorted, snap your fingers* to remove the first or the second half of the items, and repeat the process. Given an input array, what is the size of the longest s...
Solve the programming task below in a Python markdown code block. Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below. Class ID Ship ClassB or bBattleShipC or cCruiserD or dDestroyerF or fFrigate -----Input----- The first ...
Solve the programming task below in a Python markdown code block. You are given a text of single-space separated words, consisting of small and capital Latin letters. Volume of the word is number of capital letters in the word. Volume of the text is maximum volume of all words in the text. Calculate the volume of th...
Solve the programming task below in a Python markdown code block. # Task Changu and Mangu are great buddies. Once they found an infinite paper which had 1,2,3,4,5,6,7,8,......... till infinity, written on it. Both of them did not like the sequence and started deleting some numbers in the following way. ``` First t...