question
large_stringlengths
265
13.2k
Solve the programming task below in a Python markdown code block. Given is an integer r. How many times is the area of a circle of radius r larger than the area of a circle of radius 1? It can be proved that the answer is always an integer under the constraints given. -----Constraints----- - 1 \leq r \leq 100 - All...
Solve the programming task below in a Python markdown code block. Takahashi, Aoki and Snuke love cookies. They have A, B and C cookies, respectively. Now, they will exchange those cookies by repeating the action below: * Each person simultaneously divides his cookies in half and gives one half to each of the other tw...
Solve the programming task below in a Python markdown code block. D: Shiritori Compression problem Ebi-chan and Kana-chan did a shiritori. Ebi-chan is looking at the memo of the word that came out in Shiritori. Ebi-chan wants to remove redundant continuous subsequences from this word sequence w_1, w_2, ..., w_N unt...
Solve the programming task below in a Python markdown code block. Eric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph. Given a graph $G=(V,E)$, an independent set is a subset of vertices $V' \subset V$ such that for every pair $u,v \in V'$, $(u,v) \not \in E$ (i.e....
Solve the programming task below in a Python markdown code block. Dexterina and Womandark have been arch-rivals since they’ve known each other. Since both are super-intelligent teenage girls, they’ve always been trying to solve their disputes in a peaceful and nonviolent way. After god knows how many different challen...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese here ------ Problem Statement ------ Lira is a little girl form Bytenicut, a small and cozy village located in the country of Byteland.  As the village is located on a somewhat hidden and isolated area, l...
Solve the programming task below in a Python markdown code block. Let f(A, B) be the exclusive OR of A, A+1, ..., B. Find f(A, B). What is exclusive OR? The bitwise exclusive OR of integers c_1, c_2, ..., c_n (let us call it y) is defined as follows: - When y is written in base two, the digit in the 2^k's place (k \g...
Solve the programming task below in a Python markdown code block. You have $n$ coins, each of the same value of $1$. Distribute them into packets such that any amount $x$ ($1 \leq x \leq n$) can be formed using some (possibly one or all) number of these packets. Each packet may only be used entirely or not used at a...
Solve the programming task below in a Python markdown code block. The smallest unit of data handled by a computer is called a bit, and the amount of information that represents multiple bits together is called a word. Currently, many computers process one word as 32 bits. For a computer that represents one word in 32...
Solve the programming task below in a Python markdown code block. The Chef commutes to work every day using the city's underground metro. The schedule for the trains has recently been changed and he wants to know how long it will take to travel from the station nearest to his house and the station nearest to his resta...
Solve the programming task below in a Python markdown code block. A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n. Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sad now becaus...
Solve the programming task below in a Python markdown code block. # Task Given an array `arr`, find the rank of the element at the ith position. The `rank` of the arr[i] is a value equal to the number of elements `less than or equal to` arr[i] standing before arr[i], plus the number of elements `less than` arr[i] s...
Solve the programming task below in a Python markdown code block. Set Given the sequence a_1, a_2, .., a_N. How many values ​​are there in this sequence? input N a_1 a_2 ... a_N output Output the number of types of values ​​in the sequence. Constraint * 1 \ leq N \ leq 10 ^ 5 * 1 \ leq a_i \ leq 10 ^ 9 In...
Solve the programming task below in a Python markdown code block. You are given an integer sequence $a_1, a_2, \dots, a_n$. Find the number of pairs of indices $(l, r)$ ($1 \le l \le r \le n$) such that the value of median of $a_l, a_{l+1}, \dots, a_r$ is exactly the given number $m$. The median of a sequence is the...
Solve the programming task below in a Python markdown code block. Marcin is a coach in his university. There are n students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other. Let's focus on the students. They are indexed with intege...
Solve the programming task below in a Python markdown code block. Sunuke-kun's dictionary contains the words s1, ..., sn, which consist of n lowercase letters. This satisfies s1 <... <sn when compared in lexicographical order. Unfortunately, some characters are faint and unreadable. Unreadable characters are represent...
Solve the programming task below in a Python markdown code block. As a German University in Cairo (GUC) student and a basketball player, Herr Wafa was delighted once he heard the news. GUC is finally participating in the Annual Basketball Competition (ABC). A team is to be formed of n players, all of which are GUC s...
Solve the programming task below in a Python markdown code block. Find the sum of weights of edges of the Minimum Spanning Tree for a given weighted undirected graph G = (V, E). Constraints * 1 ≤ |V| ≤ 10,000 * 0 ≤ |E| ≤ 100,000 * 0 ≤ wi ≤ 10,000 * The graph is connected * There are no parallel edges * There are no ...
Solve the programming task below in a Python markdown code block. Andryusha is an orderly boy and likes to keep things in their place. Today he faced a problem to put his socks in the wardrobe. He has n distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to n. Andryusha wants to put pa...
Solve the programming task below in a Python markdown code block. Sasha lives in a big happy family. At the Man's Day all the men of the family gather to celebrate it following their own traditions. There are n men in Sasha's family, so let's number them with integers from 1 to n. Each man has at most one father but ...
Solve the programming task below in a Python markdown code block. Mishka got an integer array $a$ of length $n$ as a birthday present (what a surprise!). Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorit...
Solve the programming task below in a Python markdown code block. Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them. Let's assume that a song consists of some number of words....
Solve the programming task below in a Python markdown code block. We get more and more news about DDoS-attacks of popular websites. Arseny is an admin and he thinks that a website is under a DDoS-attack if the total number of requests for a some period of time exceeds $100 \cdot t$, where $t$ — the number of seconds ...
Solve the programming task below in a Python markdown code block. Almost Identical Programs The programming contest named Concours de Programmation Comtemporaine Interuniversitaire (CPCI) has a judging system similar to that of ICPC; contestants have to submit correct outputs for two different inputs to be accepted a...
Solve the programming task below in a Python markdown code block. Peter is a senior manager of Agile Change Management (ACM) Inc., where each employee is a member of one or more task groups. Since ACM is agile, task groups are often reorganized and their members frequently change, so membership management is his const...
Solve the programming task below in a Python markdown code block. --- # Hint This Kata is an extension of the earlier ones in this series. Completing those first will make this task easier. # Background My TV remote control has arrow buttons and an `OK` button. I can use these to move a "cursor" on a logical scr...
Solve the programming task below in a Python markdown code block. You are given two strings. In a single move, you can choose any of them, and delete the first (i.e. leftmost) character. For Example: * By applying a move to the string `"where"`, the result is the string `"here"`. * By applying a move to the string `...
Solve the programming task below in a Python markdown code block. Tetris is a game in which falling blocks are lined up on the board and erased. Here, let's consider a game that arranges it a little. The size of the board of this game is 5 frames wide, and it is high enough to accommodate all the blocks that appear. ...
Solve the programming task below in a Python markdown code block. One day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what sizes should be ordered, and on the othe...
Solve the programming task below in a Python markdown code block. Make a wish to a shooting star The mysterious organization JAG (Japanese Alumni Group) holds regular meetings. One day, the agenda was "How to enable participating teams to demonstrate their strength in the upcoming ICPC (International Collegiate Progr...
Solve the programming task below in a Python markdown code block. Bizon the Champion isn't just a bison. He also is a favorite of the "Bizons" team. At a competition the "Bizons" got the following problem: "You are given two distinct words (strings of English letters), s and t. You need to transform word s into word ...
Solve the programming task below in a Python markdown code block. Kyoya Ootori has a bag with n colored balls that are colored with k different colors. The colors are labeled from 1 to k. Balls of the same color are indistinguishable. He draws balls from the bag one by one until the bag is empty. He noticed that he dr...
Solve the programming task below in a Python markdown code block. Taro's Shopping Mammy decided to give Taro his first shopping experience. Mammy tells him to choose any two items he wants from those listed in the shopping catalogue, but Taro cannot decide which two, as all the items look attractive. Thus he plans to...
Solve the programming task below in a Python markdown code block. One day Vasya went out for a walk in the yard but there weren't any of his friends outside and he had no one to play touch and run. But the boy didn't lose the high spirits and decided to play touch and run with himself. You may ask: "How did he do that...
Solve the programming task below in a Python markdown code block. Vasya has got an array consisting of $n$ integers, and two integers $k$ and $len$ in addition. All numbers in the array are either between $1$ and $k$ (inclusive), or equal to $-1$. The array is good if there is no segment of $len$ consecutive equal num...
Solve the programming task below in a Python markdown code block. # Bubblesort Algorithm ## Overview The Bubblesort Algorithm is one of many algorithms used to sort a list of similar items (e.g. all numbers or all letters) into either ascending order or descending order. Given a list (e.g.): ```python [9, 7, 5, 3,...
Solve the programming task below in a Python markdown code block. The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arrange...
Solve the programming task below in a Python markdown code block. Let’s play a stone removing game. Initially, n stones are arranged on a circle and numbered 1, ... , n clockwise (Figure 1). You are also given two numbers k and m. From this state, remove stones one by one following the rules explained below, until on...
Solve the programming task below in a Python markdown code block. The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate. The electoral system in the country is pretty unusual. At the first stage of electi...
Solve the programming task below in a Python markdown code block. Let's denote d(n) as the number of divisors of a positive integer n. You are given three integers a, b and c. Your task is to calculate the following sum: $\sum_{i = 1}^{a} \sum_{j = 1}^{b} \sum_{k = 1}^{c} d(i \cdot j \cdot k)$ Find the sum modulo 10...
Solve the programming task below in a Python markdown code block. There are $n$ products in the shop. The price of the $i$-th product is $a_i$. The owner of the shop wants to equalize the prices of all products. However, he wants to change prices smoothly. In fact, the owner of the shop can change the price of some p...
Solve the programming task below in a Python markdown code block. Andrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $n$ rubles left, and would like to exchange them to euro and dollar bills. Andrew can mix dollar bil...
Solve the programming task below in a Python markdown code block. Given the sum and gcd of two numbers, return those two numbers in ascending order. If the numbers do not exist, return `-1`, (or `NULL` in C, `tuple (-1,-1)` in C#, `pair (-1,-1)` in C++,`None` in Rust, `array {-1,-1} ` in Java and Golang). ``` For exa...
Solve the programming task below in a Python markdown code block. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Leha is playing a very interesting game. The game will be played on a rectangular grid consisting of N rows and M columns. Initially all the cells of the grid are uncolored....
Solve the programming task below in a Python markdown code block. You are given an array $a$ consisting of $n$ integers numbered from $1$ to $n$. Let's define the $k$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $k$ (recall that a subsegment of $a$...
Solve the programming task below in a Python markdown code block. You have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the unknown, you have encountered two unusually looking skeletons called Sanz ...
Solve the programming task below in a Python markdown code block. Long is a huge fan of CFC (Codeforces Fried Chicken). But the price of CFC is increasing, so he decides to breed the chicken on his own farm. His farm is presented by a rectangle grid with r rows and c columns. Some of these cells contain rice, others ...
Solve the programming task below in a Python markdown code block. Your job is to create a calculator which evaluates expressions in [Reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation). For example expression `5 1 2 + 4 * + 3 -` (which is equivalent to `5 + ((1 + 2) * 4) - 3` in normal nota...
Solve the programming task below in a Python markdown code block. You are given $n$ integer numbers $a_1, a_2, \dots, a_n$. Consider graph on $n$ nodes, in which nodes $i$, $j$ ($i\neq j$) are connected if and only if, $a_i$ AND $a_j\neq 0$, where AND denotes the bitwise AND operation. Find the length of the shortest...
Solve the programming task below in a Python markdown code block. ### Description As hex values can include letters `A` through to `F`, certain English words can be spelled out, such as `CAFE`, `BEEF`, or `FACADE`. This vocabulary can be extended by using numbers to represent other letters, such as `5EAF00D`, or `DEC0...
Solve the programming task below in a Python markdown code block. Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions whatsoever that can b...
Solve the programming task below in a Python markdown code block. Polycarp has $26$ tasks. Each task is designated by a capital letter of the Latin alphabet. The teacher asked Polycarp to solve tasks in the following way: if Polycarp began to solve some task, then he must solve it to the end, without being distracted...
Solve the programming task below in a Python markdown code block. You have been recruited by an unknown organization for your cipher encrypting/decrypting skills. Being new to the organization they decide to test your skills. Your first test is to write an algorithm that encrypts the given string in the following ...
Solve the programming task below in a Python markdown code block. Given n number of people in a room, calculate the probability that any two people in that room have the same birthday (assume 365 days every year = ignore leap year). Answers should be two decimals unless whole (0 or 1) eg 0.05 Write your solution by m...
Solve the programming task below in a Python markdown code block. Fans of The Wire will appreciate this one. For those that haven't seen the show, the Barksdale Organization has a simple method for encoding telephone numbers exchanged via pagers: "Jump to the other side of the 5 on the keypad, and swap 5's and 0's." ...
Solve the programming task below in a Python markdown code block. The educational program (AHK Education) of the Aiz Broadcasting Association broadcasts a handicraft program for children, "Play with Tsukuro". Today is the time to make a rectangle with sticks, but I would like to see if I can make a rectangle using the...
Solve the programming task below in a Python markdown code block. You are given an initial 2-value array (x). You will use this to calculate a score. If both values in (x) are numbers, the score is the sum of the two. If only one is a number, the score is that number. If neither is a number, return 'Void!'. Once yo...
Solve the programming task below in a Python markdown code block. You play your favourite game yet another time. You chose the character you didn't play before. It has $str$ points of strength and $int$ points of intelligence. Also, at start, the character has $exp$ free experience points you can invest either in stre...
Solve the programming task below in a Python markdown code block. Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia. For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs $n$ actions. The first action perf...
Solve the programming task below in a Python markdown code block. Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question. Suppose you are given a positive integer $a$. You want to choose some integer $b$ from $1$ to $a - 1$ inclusive in such a way that the g...
Solve the programming task below in a Python markdown code block. We have N points in a two-dimensional plane. The coordinates of the i-th point (1 \leq i \leq N) are (x_i,y_i). Let us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior. Here,...
Solve the programming task below in a Python markdown code block. Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to c...
Solve the programming task below in a Python markdown code block. John Doe has an n × m table. John Doe can paint points in some table cells, not more than one point in one table cell. John Doe wants to use such operations to make each square subtable of size n × n have exactly k points. John Doe wondered, how many d...
Solve the programming task below in a Python markdown code block. Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and 1 "11". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of ...
Solve the programming task below in a Python markdown code block. [Image] -----Input----- The input consists of four lines, each line containing a single digit 0 or 1. -----Output----- Output a single digit, 0 or 1. -----Example----- Input 0 1 1 0 Output 0 Read the inputs from stdin solve the problem and w...
Solve the programming task below in a Python markdown code block. problem Given a sequence of n integers a1, a2, ..., an and a positive integer k (1 ≤ k ≤ n), then the sum of k consecutive integers Si = ai + ai + Create a program that outputs the maximum value of 1 + ... + ai + k-1 (1 ≤ i ≤ n --k + 1). input The ...
Solve the programming task below in a Python markdown code block. There is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - (2kx, 0) – (2kx + x, x) – .... We know that the polyline passes through the point (a, b). Find minimum positive value x such that it is true or determine th...
Solve the programming task below in a Python markdown code block. Petya loves computer games. Finally a game that he's been waiting for so long came out! The main character of this game has n different skills, each of which is characterized by an integer a_{i} from 0 to 100. The higher the number a_{i} is, the higher...
Solve the programming task below in a Python markdown code block. Write a program which calculates the area and circumference of a circle for given radius r. Constraints * 0 < r < 10000 Input A real number r is given. Output Print the area and circumference of the circle in a line. Put a single space between the...
Solve the programming task below in a Python markdown code block. Enter a positive integer n of 4,000 or less, with a pair of integers a, b, c, d in the range 0-1000. a + b + c + d = n Create a program that outputs the number of combinations that satisfy the conditions. Input Given multiple datasets. Each data...
Solve the programming task below in a Python markdown code block. In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scouter, if there are two B...
Solve the programming task below in a Python markdown code block. Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring car...
Solve the programming task below in a Python markdown code block. The prime numbers are not regularly spaced. For example from `2` to `3` the step is `1`. From `3` to `5` the step is `2`. From `7` to `11` it is `4`. Between 2 and 50 we have the following pairs of 2-steps primes: `3, 5 - 5, 7, - 11, 13, - 17, 19, - 29...
Solve the programming task below in a Python markdown code block. Let $f_{x} = c^{2x-6} \cdot f_{x-1} \cdot f_{x-2} \cdot f_{x-3}$ for $x \ge 4$. You have given integers $n$, $f_{1}$, $f_{2}$, $f_{3}$, and $c$. Find $f_{n} \bmod (10^{9}+7)$. -----Input----- The only line contains five integers $n$, $f_{1}$, $f_{2}...
Solve the programming task below in a Python markdown code block. Polycarp found $n$ segments on the street. A segment with the index $i$ is described by two integers $l_i$ and $r_i$ — coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all the segments, so he wante...
Solve the programming task below in a Python markdown code block. The Smart Beaver from ABBYY was offered a job of a screenwriter for the ongoing TV series. In particular, he needs to automate the hard decision: which main characters will get married by the end of the series. There are n single men and n single women...
Solve the programming task below in a Python markdown code block. You've arrived at a carnival and head straight for the duck shooting tent. Why wouldn't you? You will be given a set amount of ammo, and an aim rating of between 1 and 0. No your aim is not always perfect - hey maybe someone fiddled with the sights on ...
Solve the programming task below in a Python markdown code block. The only difference between easy and hard versions is the constraints. Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $n$ consecutive pictures (with kittens, of course). Vova likes all th...
Solve the programming task below in a Python markdown code block. Chouti is working on a strange math problem. There was a sequence of $n$ positive integers $x_1, x_2, \ldots, x_n$, where $n$ is even. The sequence was very special, namely for every integer $t$ from $1$ to $n$, $x_1+x_2+...+x_t$ is a square of some in...
Solve the programming task below in a Python markdown code block. The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h_1 cm from the ground. On the height h_2 cm (h_2 > h_1) on the same tree hung an apple and the caterpill...
Solve the programming task below in a Python markdown code block. This problem uses a simplified network topology model, please read the problem statement carefully and use it as a formal document as you develop the solution. Polycarpus continues working as a system administrator in a large corporation. The computer ...
Solve the programming task below in a Python markdown code block. Colour plays an important role in our lifes. Most of us like this colour better then another. User experience specialists believe that certain colours have certain psychological meanings for us. You are given a 2D array, composed of a colour and its 'c...
Solve the programming task below in a Python markdown code block. Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It's known that the length of the number didn't change. You hav...
Solve the programming task below in a Python markdown code block. You are playing a new computer game in which you have to fight monsters. In a dungeon you are trying to clear, you met three monsters; the first of them has $a$ health points, the second has $b$ health points, and the third has $c$. To kill the monster...
Solve the programming task below in a Python markdown code block. A festival will be held in a town's main street. There are n sections in the main street. The sections are numbered 1 through n from left to right. The distance between each adjacent sections is 1. In the festival m fireworks will be launched. The i-th...
Solve the programming task below in a Python markdown code block. Have you ever implemented a program adding two big integers that cannot be represented by the primitive data type of your programming language? The algorithm is just simulation of the column addition method that we have been taught in elementary school....
Solve the programming task below in a Python markdown code block. Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the collection. For example: ```["3:1", "2:2", "0:1", ...]``` Write a function that takes such collection and counts the poin...
Solve the programming task below in a Python markdown code block. In the year 2020, a race of atomically energized cars will be held. Unlike today’s car races, fueling is not a concern of racing teams. Cars can run throughout the course without any refueling. Instead, the critical factor is tire (tyre). Teams should c...
Solve the programming task below in a Python markdown code block. You are given two integers $x$ and $y$ (it is guaranteed that $x > y$). You may choose any prime integer $p$ and subtract it any number of times from $x$. Is it possible to make $x$ equal to $y$? Recall that a prime number is a positive integer that ha...
Solve the programming task below in a Python markdown code block. In 2300, the Life Science Division of Federal Republic of Space starts a very ambitious project to complete the genome sequencing of all living creatures in the entire universe and develop the genomic database of all space life. Thanks to scientific res...
Solve the programming task below in a Python markdown code block. qd ucyhf yi q fhycu dkcruh mxeiu huluhiu yi q tyvvuhudj fhycu dkcruh. oekh jqia yi je vydt jxu djx ucyhf. Input jxu ydfkj sediyiji ev q iydwbu ydjuwuh d (1 ≤ d ≤ 11184) — jxu edu-rqiut ydtun ev jxu ucyhf je vydt. Output ekjfkj q iydwbu dkcruh. Exam...
Solve the programming task below in a Python markdown code block. You are given a string S consisting of lowercase English letters. Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations. -----...
Solve the programming task below in a Python markdown code block. The prime numbers are not regularly spaced. For example from `2` to `3` the gap is `1`. From `3` to `5` the gap is `2`. From `7` to `11` it is `4`. Between 2 and 50 we have the following pairs of 2-gaps primes: `3-5, 5-7, 11-13, 17-19, 29-31, 41-43` A ...
Solve the programming task below in a Python markdown code block. Problem A Secret of Chocolate Poles Wendy, the master of a chocolate shop, is thinking of displaying poles of chocolate disks in the showcase. She can use three kinds of chocolate disks: white thin disks, dark thin disks, and dark thick disks. The thin...
Solve the programming task below in a Python markdown code block. Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubina comes to his office and sabotage his re...
Solve the programming task below in a Python markdown code block. Dr. Akita, who lives in the neighborhood, is a historical researcher in the field and recently discovered a new ancient document about Ono no Komachi. It is widely known that Ono no Komachi has given General Fukakusa, who wants to be dating, on conditi...
Solve the programming task below in a Python markdown code block. Write function alternateCase which switch every letter in string from upper to lower and from lower to upper. E.g: Hello World -> hELLO wORLD Write your solution by modifying this code: ```python def alternateCase(s): ``` Your solution should imple...
Solve the programming task below in a Python markdown code block. Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper. At least how many sheets of paper does he need? -----Constraints----- - N is an integer. - 1 \leq N \leq 100 -----Input-----...
Solve the programming task below in a Python markdown code block. Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n. The Koch curve is well known as a kind of fractals. You can draw a Koch curve in the following algorithm: * Divide a given segment (p1, p2) into thr...
Solve the programming task below in a Python markdown code block. ## Task Given a positive integer as input, return the output as a string in the following format: Each element, corresponding to a digit of the number, multiplied by a power of 10 in such a way that with the sum of these elements you can obtain the o...