question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. In this Kata we focus on finding a sum S(n) which is the total number of divisors taken for all natural numbers less or equal to n. More formally, we investigate the sum of n components denoted by d(1) + d(2) + ... + d(n) in which for any i starting fro...
Solve the programming task below in a Python markdown code block. Once upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting techniques and tactics of the squ...
Solve the programming task below in a Python markdown code block. Serval soon said goodbye to Japari kindergarten, and began his life in Japari Primary School. In his favorite math class, the teacher taught him the following interesting definitions. A parenthesis sequence is a string, containing only characters "(" ...
Solve the programming task below in a Python markdown code block. Miyako came to the flea kingdom with a ukulele. She became good friends with local flea residents and played beautiful music for them every day. In return, the fleas made a bigger ukulele for her: it has $n$ strings, and each string has $(10^{18} + 1)$...
Solve the programming task below in a Python markdown code block. The range search problem consists of a set of attributed records S to determine which records from S intersect with a given range. For n points on a plane, report a set of points which are within in a given range. Note that you do not need to consider ...
Solve the programming task below in a Python markdown code block. Cara is applying for several different jobs. The online application forms ask her to respond within a specific character count. Cara needs to check that her answers fit into the character limit. Annoyingly, some application forms count spaces as a char...
Solve the programming task below in a Python markdown code block. In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n...
Solve the programming task below in a Python markdown code block. On a history lesson the teacher asked Vasya to name the dates when n famous events took place. He doesn't remembers the exact dates but he remembers a segment of days [li, ri] (inclusive) on which the event could have taken place. However Vasya also rem...
Solve the programming task below in a Python markdown code block. Mr. Bill is shopping at the store. There are some coins in his wallet (10-yen coins, 50-yen coins, 100-yen coins, 500-yen coins), but he is now trying to consume as much of this coin as possible. In other words, by paying for the goods with an appropria...
Solve the programming task below in a Python markdown code block. To get on the Shinkansen, you need two tickets, a "ticket" and a "limited express ticket". These are separate tickets because some of the routes may not use the Shinkansen, but for routes that use only the Shinkansen, one ticket can be used as both a ti...
Solve the programming task below in a Python markdown code block. ICPC Calculator In mathematics, we usually specify the order of operations by using parentheses. For example, 7 × (3 + 2) always means multiplying 7 by the result of 3 + 2 and never means adding 2 to the result of 7 × 3. However, there are people who d...
Solve the programming task below in a Python markdown code block. There are n beacons located at distinct positions on a number line. The i-th beacon has position ai and power level bi. When the i-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance bi inclu...
Solve the programming task below in a Python markdown code block. Mary wrote a recipe book and is about to publish it, but because of a new European law, she needs to update and include all measures in grams. Given all the measures in tablespoon (`tbsp`) and in teaspoon (`tsp`), considering `1 tbsp = 15g` and `1 tsp ...
Solve the programming task below in a Python markdown code block. Colossal! — exclaimed Hawk-nose. — A programmer! That's exactly what we are looking for.Arkadi and Boris Strugatsky. Monday starts on Saturday Reading the book "Equations of Mathematical Magic" Roman Oira-Oira and Cristobal Junta found an interesting e...
Solve the programming task below in a Python markdown code block. Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements. ```python move_zeros([False,1,0,1,2,0,1,3,"a"]) # returns[False,1,1,2,1,3,"a",0,0] ``` Write your solution by modifying this code...
Solve the programming task below in a Python markdown code block. Snuke has a string S consisting of three kinds of letters: `a`, `b` and `c`. He has a phobia for palindromes, and wants to permute the characters in S so that S will not contain a palindrome of length 2 or more as a substring. Determine whether this is...
Solve the programming task below in a Python markdown code block. Codefortia is a small island country located somewhere in the West Pacific. It consists of $n$ settlements connected by $m$ bidirectional gravel roads. Curiously enough, the beliefs of the inhabitants require the time needed to pass each road to be equa...
Solve the programming task below in a Python markdown code block. Given is a number sequence A of length N. Find the number of integers i \left(1 \leq i \leq N\right) with the following property: - For every integer j \left(1 \leq j \leq N\right) such that i \neq j , A_j does not divide A_i. -----Constraints----- -...
Solve the programming task below in a Python markdown code block. Create a program that will take in a string as input and, if there are duplicates of more than two alphabetical characters in the string, returns the string with all the extra characters in a bracket. For example, the input "aaaabbcdefffffffg" should r...
Solve the programming task below in a Python markdown code block. We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical gir...
Solve the programming task below in a Python markdown code block. Berland shop sells $n$ kinds of juices. Each juice has its price $c_i$. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin "A", vitamin "B" and vitamin "C". Each juice can contain one, two or all three types of vi...
Solve the programming task below in a Python markdown code block. Bran and his older sister Arya are from the same house. Bran like candies so much, so Arya is going to give him some Candies. At first, Arya and Bran have 0 Candies. There are n days, at the i-th day, Arya finds a_{i} candies in a box, that is given by...
Solve the programming task below in a Python markdown code block. Two T-shirt sizes are given: $a$ and $b$. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L. For example, strings M, XXL, S, XXXXXXXS could be the size of some T-shirts...
Solve the programming task below in a Python markdown code block. Every Friday and Saturday night, farmer counts amount of sheep returned back to his farm (sheep returned on Friday stay and don't leave for a weekend). Sheep return in groups each of the days -> you will be given two arrays with these numbers (one for ...
Solve the programming task below in a Python markdown code block. Given positive integers N, K and M, solve the following problem for every integer x between 1 and N (inclusive): - Find the number, modulo M, of non-empty multisets containing between 0 and K (inclusive) instances of each of the integers 1, 2, 3 \cdots...
Solve the programming task below in a Python markdown code block. The letters shop showcase is a string s, consisting of n lowercase Latin letters. As the name tells, letters are sold in the shop. Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the...
Solve the programming task below in a Python markdown code block. Heading ##There are two integers A and B. You are required to compute the bitwise AND amongst all natural numbers lying between A and B, both inclusive. Input Format First line of the input contains T, the number of testcases to follow. Each testcase i...
Solve the programming task below in a Python markdown code block. ## Grade book Complete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade. Numerical Score | Letter Grade --- | --- 90 <= score <= 100 | 'A' 80 <= score < 9...
Solve the programming task below in a Python markdown code block. In Manhattan, roads run where the x or y coordinate is an integer. Both Sunuke-kun's house and Sumeke-kun's house are on the road, and the straight line distance (Euclidean distance) is just d. Find the maximum value that can be considered as the shorte...
Solve the programming task below in a Python markdown code block. Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in ...
Solve the programming task below in a Python markdown code block. If the girl doesn't go to Denis, then Denis will go to the girl. Using this rule, the young man left home, bought flowers and went to Nastya. On the way from Denis's house to the girl's house is a road of n lines. This road can't be always crossed in ...
Solve the programming task below in a Python markdown code block. Bob is an active user of the social network Faithbug. On this network, people are able to engage in a mutual friendship. That is, if $a$ is a friend of $b$, then $b$ is also a friend of $a$. Each user thus has a non-negative amount of friends. This mor...
Solve the programming task below in a Python markdown code block. The greatest common divisor is an indispensable element in mathematics handled on a computer. Using the greatest common divisor can make a big difference in the efficiency of the calculation. One of the algorithms to find the greatest common divisor is ...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese and Russian. Vidhi went to a magic show last week where she was astounded by a magic trick performed by the great Mandwarf, the brown. His trick was as follows : Ask a volunteer from the audience to write ...
Solve the programming task below in a Python markdown code block. ## Task Implement a function which finds the numbers less than `2`, and the indices of numbers greater than `1` in the given sequence, and returns them as a pair of sequences. Return a nested array or a tuple depending on the language: * The first s...
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 to test if it's a numerical ...
Solve the programming task below in a Python markdown code block. International Abbreviation Olympiad takes place annually starting from 1989. Each year the competition receives an abbreviation of form IAO'y, where y stands for some number of consequent last digits of the current year. Organizers always pick an abbrev...
Solve the programming task below in a Python markdown code block. In the probability theory the following paradox called Benford's law is known: "In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any other digit" (that's the simplest...
Solve the programming task below in a Python markdown code block. You got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts. Suppose you decided to sell packs with $a$ cans in a pack with a discount and some c...
Solve the programming task below in a Python markdown code block. You are given an array $a$ consisting of $n$ non-negative integers. It is guaranteed that $a$ is sorted from small to large. For each operation, we generate a new array $b_i=a_{i+1}-a_{i}$ for $1 \le i < n$. Then we sort $b$ from small to large, replac...
Solve the programming task below in a Python markdown code block. Turtle Shi-ta and turtle Be-ko decided to divide a chocolate. The shape of the chocolate is rectangle. The corners of the chocolate are put on (0,0), (w,0), (w,h) and (0,h). The chocolate has lines for cutting. They cut the chocolate only along some of ...
Solve the programming task below in a Python markdown code block. On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days of...
Solve the programming task below in a Python markdown code block. Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number a_{i} written on it. They take turns playing, starting with Conan. In each ...
Solve the programming task below in a Python markdown code block. Learning to code around your full time job is taking over your life. You realise that in order to make significant steps quickly, it would help to go to a coding bootcamp in London. Problem is, many of them cost a fortune, and those that don't still in...
Solve the programming task below in a Python markdown code block. $2^n$ teams participate in a playoff tournament. The tournament consists of $2^n - 1$ games. They are held as follows: in the first phase of the tournament, the teams are split into pairs: team $1$ plays against team $2$, team $3$ plays against team $4$...
Solve the programming task below in a Python markdown code block. You are given integers A and B, each between 1 and 3 (inclusive). Determine if there is an integer C between 1 and 3 (inclusive) such that A \times B \times C is an odd number. -----Constraints----- - All values in input are integers. - 1 \leq A, B \...
Solve the programming task below in a Python markdown code block. You are given an array of integers. Your task is to sort odd numbers within the array in ascending order, and even numbers in descending order. Note that zero is an even number. If you have an empty array, you need to return it. For example: ``` [5, ...
Solve the programming task below in a Python markdown code block. Below is a right-angled triangle: ``` |\ | \ | \ | \ o | \ h | \ | θ \ |_______\ a ``` Your challange is to write a function (```missingAngle``` in C/C#, ```missing_angle``` in Ruby), that calculates the angle θ in d...
Solve the programming task below in a Python markdown code block. Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor GCD(a, b), for example, Euclid a...
Solve the programming task below in a Python markdown code block. Awruk is taking part in elections in his school. It is the final round. He has only one opponent — Elodreip. The are $n$ students in the school. Each student has exactly $k$ votes and is obligated to use all of them. So Awruk knows that if a person give...
Solve the programming task below in a Python markdown code block. -----Input----- The input contains a single integer $a$ ($1 \le a \le 99$). -----Output----- Output "YES" or "NO". -----Examples----- Input 5 Output YES Input 13 Output NO Input 24 Output NO Input 46 Output YES Read the inputs from stdin ...
Solve the programming task below in a Python markdown code block. Nantendo Co., Ltd. has released a game software called Packet Monster. This game was intended to catch, raise, and fight monsters, and was a very popular game all over the world. This game had features not found in traditional games. There are two vers...
Solve the programming task below in a Python markdown code block. Don't Drink the Water Given a two-dimensional array representation of a glass of mixed liquids, sort the array such that the liquids appear in the glass based on their density. (Lower density floats to the top) The width of the glass will not change fr...
Solve the programming task below in a Python markdown code block. There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided as well that it is nece...
Solve the programming task below in a Python markdown code block. During the winter holidays, the demand for Christmas balls is exceptionally high. Since it's already 2018, the advances in alchemy allow easy and efficient ball creation by utilizing magic crystals. Grisha needs to obtain some yellow, green and blue ba...
Solve the programming task below in a Python markdown code block. # The Invitation Most of us played with toy blocks growing up. It was fun and you learned stuff. So what else can you do but rise to the challenge when a 3-year old exclaims, "Look, I made a square!", then pointing to a pile of blocks, "Can _you_ do it...
Solve the programming task below in a Python markdown code block. Encryption System A programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are `encrypted' to the same string. We have a string encrypted by his system. To decode the original string, we want t...
Solve the programming task below in a Python markdown code block. Thanks to the effects of El Nino this year my holiday snorkelling trip was akin to being in a washing machine... Not fun at all. Given a string made up of '~' and '\_' representing waves and calm respectively, your job is to check whether a person woul...
Solve the programming task below in a Python markdown code block. Astronaut Natasha arrived on Mars. She knows that the Martians are very poor aliens. To ensure a better life for the Mars citizens, their emperor decided to take tax from every tourist who visited the planet. Natasha is the inhabitant of Earth, therefor...
Solve the programming task below in a Python markdown code block. You are given two integers A and B as the input. Output the value of A + B. However, if A + B is 10 or greater, output error instead. -----Constraints----- - A and B are integers. - 1 ≤ A, B ≤ 9 -----Input----- Input is given from Standard Input in ...
Solve the programming task below in a Python markdown code block. You are given a chessboard of size 1 × n. It is guaranteed that n is even. The chessboard is painted like this: "BWBW...BW". Some cells of the board are occupied by the chess pieces. Each cell contains no more than one chess piece. It is known that the...
Solve the programming task below in a Python markdown code block. Two players are playing a game. The game is played on a sequence of positive integer pairs. The players make their moves alternatively. During his move the player chooses a pair and decreases the larger integer in the pair by a positive multiple of the ...
Solve the programming task below in a Python markdown code block. Your task is to find the number couple with the greatest difference from a given array of number-couples. All number couples will be given as strings and all numbers in them will be positive integers. For instance: ['56-23','1-100']; in this case, ...
Solve the programming task below in a Python markdown code block. Assume that a, b, and n are all positive integers. Let f (i) be the i-th fraction of the fraction a / b (0 ≤ f (i) ≤ 9). At this time, let s be the sum of f (i) from i = 1 to n. s = f (1) + f (2) + ... + f (n) Create a program that reads a, b, n, out...
Solve the programming task below in a Python markdown code block. At regular competition Vladik and Valera won a and b candies respectively. Vladik offered 1 his candy to Valera. After that Valera gave Vladik 2 his candies, so that no one thought that he was less generous. Vladik for same reason gave 3 candies to Vale...
Solve the programming task below in a Python markdown code block. We all know about Roman Numerals, and if not, here's a nice [introduction kata](http://www.codewars.com/kata/5580d8dc8e4ee9ffcb000050). And if you were anything like me, you 'knew' that the numerals were not used for zeroes or fractions; but not so! I ...
Solve the programming task below in a Python markdown code block. Well met with Fibonacci bigger brother, AKA Tribonacci. As the name may already reveal, it works basically like a Fibonacci, but summing the last 3 (instead of 2) numbers of the sequence to generate the next. And, worse part of it, regrettably I won't ...
Solve the programming task below in a Python markdown code block. There is a string s of length 3 or greater. No two neighboring characters in s are equal. Takahashi and Aoki will play a game against each other. The two players alternately performs the following operation, Takahashi going first: - Remove one of the c...
Solve the programming task below in a Python markdown code block. We have N integers. The i-th integer is A_i. Find \sum_{i=1}^{N-1}\sum_{j=i+1}^{N} (A_i \mbox{ XOR } A_j), modulo (10^9+7).What is \mbox{ XOR }? The XOR of integers A and B, A \mbox{ XOR } B, is defined as follows: - When A \mbox{ XOR } B is written ...
Solve the programming task below in a Python markdown code block. Little Petya very much likes computers. Recently he has received a new "Ternatron IV" as a gift from his mother. Unlike other modern computers, "Ternatron IV" operates with ternary and not binary logic. Petya immediately wondered how the xor operation i...
Solve the programming task below in a Python markdown code block. There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana"...
Solve the programming task below in a Python markdown code block. Once Bob saw a string. It contained so many different letters, that the letters were marked by numbers, but at the same time each letter could be met in the string at most 10 times. Bob didn't like that string, because it contained repeats: a repeat of ...
Solve the programming task below in a Python markdown code block. Write a program which reads $n$ items and sorts them. Each item has attributes $\\{value, weight, type, date, name\\}$ and they are represented by $\\{$ integer, integer, upper-case letter, integer, string $\\}$ respectively. Sort the items based on the...
Solve the programming task below in a Python markdown code block. You are given two arrays $a_1, a_2, \dots , a_n$ and $b_1, b_2, \dots , b_m$. Array $b$ is sorted in ascending order ($b_i < b_{i + 1}$ for each $i$ from $1$ to $m - 1$). You have to divide the array $a$ into $m$ consecutive subarrays so that, for each...
Solve the programming task below in a Python markdown code block. After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them. Of course, the area of the rect...
Solve the programming task below in a Python markdown code block. For an integer n not less than 0, let us define f(n) as follows: - f(n) = 1 (if n < 2) - f(n) = n f(n-2) (if n \geq 2) Given is an integer N. Find the number of trailing zeros in the decimal notation of f(N). -----Constraints----- - 0 \leq N \leq 10...
Solve the programming task below in a Python markdown code block. Matrix of given integers a1,1 a1,2 ... a1, n a2,1 a2,2 ... a2, n :: an, 1 an, 2 ... an, n Then, create a program that outputs the maximum value of the sum of one or more consecutive terms (submatrix) in the vertical and horizontal directions and end...
Solve the programming task below in a Python markdown code block. One day, Yuhao came across a problem about checking if some bracket sequences are correct bracket sequences. A bracket sequence is any non-empty sequence of opening and closing parentheses. A bracket sequence is called a correct bracket sequence if it'...
Solve the programming task below in a Python markdown code block. A family of kookaburras are in my backyard. I can't see them all, but I can hear them! # How many kookaburras are there? ## Hint The trick to counting kookaburras is to listen carefully * The males go ```HaHaHa```... * The females go ```hahaha...
Solve the programming task below in a Python markdown code block. Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to become a photographer instead. As you may know, the coolest photos are on the film (...
Solve the programming task below in a Python markdown code block. The busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops. If $x$ is the number of passengers in a bus just before the current bus stop and $y$ is ...
Solve the programming task below in a Python markdown code block. Roy is going through the dark times of his life. Recently his girl friend broke up with him and to overcome the pain of acute misery he decided to restrict himself to Eat-Sleep-Code life cycle. For N days he did nothing but eat, sleep and code. A clo...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese and Russian. Chef has a box full of infinite number of identical coins. One day while playing, he made N piles each containing equal number of coins. Chef suddenly remembered an important task and left the...
Solve the programming task below in a Python markdown code block. There are N mountains ranging from east to west, and an ocean to the west. At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns. The height of the i-th mountain from the west is H_i. You can certainly se...
Solve the programming task below in a Python markdown code block. CODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard. He intended to write `CODEFESTIVAL2016` on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length. ...
Solve the programming task below in a Python markdown code block. Now that Kuroni has reached 10 years old, he is a big boy and doesn't like arrays of integers as presents anymore. This year he wants a Bracket sequence as a Birthday present. More specifically, he wants a bracket sequence so complex that no matter how ...
Solve the programming task below in a Python markdown code block. Construct a dice from a given sequence of integers in the same way as Dice I. You are given integers on the top face and the front face after the dice was rolled in the same way as Dice I. Write a program to print an integer on the right side face. <...
Solve the programming task below in a Python markdown code block. The on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals v_1 meters per second, and in the end it is v_2 meters per second. We know that this section of the route took exactly t seconds to p...
Solve the programming task below in a Python markdown code block. The word internationalization is sometimes abbreviated to i18n. This comes from the fact that there are 18 letters between the first i and the last n. You are given a string s of length at least 3 consisting of lowercase English letters. Abbreviate s in...
Solve the programming task below in a Python markdown code block. The Duck song For simplicity, we'll assume that there are only three types of grapes: green grapes, purple grapes and black grapes. Andrew, Dmitry and Michal are all grapes' lovers, however their preferences of grapes are different. To make all of the...
Solve the programming task below in a Python markdown code block. Gerald has been selling state secrets at leisure. All the secrets cost the same: n marks. The state which secrets Gerald is selling, has no paper money, only coins. But there are coins of all positive integer denominations that are powers of three: 1 ma...
Solve the programming task below in a Python markdown code block. Recently Johnny have learned bogosort sorting algorithm. He thought that it is too ineffective. So he decided to improve it. As you may know this algorithm shuffles the sequence randomly until it is sorted. Johnny decided that we don't need to shuffle t...
Solve the programming task below in a Python markdown code block. # Task You are given three integers `l, d and x`. Your task is: ``` • determine the minimal integer n such that l ≤ n ≤ d, and the sum of its digits equals x. • determine the maximal integer m such that l ≤ m ≤ d, and the sum of its digits eq...
Solve the programming task below in a Python markdown code block. Switch/Case - Bug Fixing #6 Oh no! Timmy's evalObject function doesn't work. He uses Switch/Cases to evaluate the given properties of an object, can you fix timmy's function? Write your solution by modifying this code: ```python def eval_object(v): ...
Solve the programming task below in a Python markdown code block. Innokenty works at a flea market and sells some random stuff rare items. Recently he found an old rectangular blanket. It turned out that the blanket is split in $n \cdot m$ colored pieces that form a rectangle with $n$ rows and $m$ columns. The color...
Solve the programming task below in a Python markdown code block. A carpet shop sells carpets in different varieties. Each carpet can come in a different roll width and can have a different price per square meter. Write a function `cost_of_carpet` which calculates the cost (rounded to 2 decimal places) of carpeting ...
Solve the programming task below in a Python markdown code block. There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut th...
Solve the programming task below in a Python markdown code block. DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. Aft...
Solve the programming task below in a Python markdown code block. In poker, you have 5 cards. There are 10 kinds of poker hands (from highest to lowest): - royal flush - ace, king, queen, jack and ten, all in the same suit - straight flush - five cards of the same suit in sequence, such as 10,9,8,7,6 of clubs; ace...
Solve the programming task below in a Python markdown code block. Description KMC sells CDs every year at a coterie spot sale called Comic Market. F was supposed to sell CDs at the comic market, but due to the popularity of F, the KMC sales floor was flooded with people, and the calculation of change could not keep u...