question large_stringlengths 265 13.2k |
|---|
Solve the programming task below in a Python markdown code block.
You are given an array consisting of n integers a_1, a_2, ..., a_n. Initially a_x = 1, all other elements are equal to 0.
You have to perform m operations. During the i-th operation, you choose two indices c and d such that l_i β€ c, d β€ r_i, and swap a... |
Solve the programming task below in a Python markdown code block.
You are given a non-decreasing array of non-negative integers a_1, a_2, β¦, a_n. Also you are given a positive integer k.
You want to find m non-decreasing arrays of non-negative integers b_1, b_2, β¦, b_m, such that:
* The size of b_i is equal to n f... |
Solve the programming task below in a Python markdown code block.
There are some rabbits in Singapore Zoo. To feed them, Zookeeper bought n carrots with lengths a_1, a_2, a_3, β¦, a_n. However, rabbits are very fertile and multiply very quickly. Zookeeper now has k rabbits and does not have enough carrots to feed all o... |
Solve the programming task below in a Python markdown code block.
Jeel and Ashish play a game on an n Γ m matrix. The rows are numbered 1 to n from top to bottom and the columns are numbered 1 to m from left to right. They play turn by turn. Ashish goes first.
Initially, each cell of the matrix contains a non-negativ... |
Solve the programming task below in a Python markdown code block.
Masha works in an advertising agency. In order to promote the new brand, she wants to conclude contracts with some bloggers. In total, Masha has connections of n different bloggers. Blogger numbered i has a_i followers.
Since Masha has a limited budget... |
Solve the programming task below in a Python markdown code block.
Monocarp is playing a game "Assimilation IV". In this game he manages a great empire: builds cities and conquers new lands.
Monocarp's empire has n cities. In order to conquer new lands he plans to build one Monument in each city. The game is turn-base... |
Solve the programming task below in a Python markdown code block.
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some p... |
Solve the programming task below in a Python markdown code block.
The Smart Beaver from ABBYY began to develop a new educational game for children. The rules of the game are fairly simple and are described below.
The playing field is a sequence of n non-negative integers ai numbered from 1 to n. The goal of the game ... |
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.
Dima's got a staircase that consists of n stairs. The first stair is at height a1, the second one is at a2, the last one is at an (1 β€ a1 β€ a2 β€ ... β€ an).
Dima decided to play with the staircase, so he is throwing rectangular boxes at the staircase f... |
Solve the programming task below in a Python markdown code block.
Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money.
The manager of logging factory wants them to go to the jungle and cut n trees with heights a1, a2, ..., an. They bought a ... |
Solve the programming task below in a Python markdown code block.
Mad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but n different heads that can read data in parallel.
When viewed from the side, Mike's hard drive is an endless array of tracks. The tracks of the array are... |
Solve the programming task below in a Python markdown code block.
Dima loves Inna very much. He decided to write a song for her. Dima has a magic guitar with n strings and m frets. Dima makes the guitar produce sounds like that: to play a note, he needs to hold one of the strings on one of the frets and then pull the ... |
Solve the programming task below in a Python markdown code block.
Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart.
Let us consider the building process. Vasya takes a brick and puts it on top of the already bu... |
Solve the programming task below in a Python markdown code block.
Last year the world's largest square was built in Berland. It is known that the square can be represented as an infinite plane with an introduced Cartesian system of coordinates. On that square two sets of concentric circles were painted. Let's call the... |
Solve the programming task below in a Python markdown code block.
Of course our child likes walking in a zoo. The zoo has n areas, that are numbered from 1 to n. The i-th area contains ai animals in it. Also there are m roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you... |
Solve the programming task below in a Python markdown code block.
Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.
Your task is to find such permutation p of length n, that the group ... |
Solve the programming task below in a Python markdown code block.
You are given an array of positive integers a1, a2, ..., an Γ T of length n Γ T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.
Input
The first line contains two space... |
Solve the programming task below in a Python markdown code block.
Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection safe during t... |
Solve the programming task below in a Python markdown code block.
Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list of n (not necessarily distinct) integers. Find the non-empty subset (with repetition) with the maximum simple skewness.
The mean of... |
Solve the programming task below in a Python markdown code block.
There exists an island called Arpaβs land, some beautiful girls live there, as ugly ones do.
Mehrdad wants to become minister of Arpaβs land. Arpa has prepared an exam. Exam has only one question, given n, print the last digit of 1378n.
<image>
Mehr... |
Solve the programming task below in a Python markdown code block.
Vanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex v, and two disjoint (except for v) paths of equal length a0 = v, a1, ..., ak, and b0 = v, b1, ..., bk. Additionally, vertices a1, ..., ak, b1, ..., bk... |
Solve the programming task below in a Python markdown code block.
Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.
You are given geometric progression b defined by two integers b1 and q. Remind that a geometric progression is a sequence of integers b1, b2, b3, ..., whe... |
Solve the programming task below in a Python markdown code block.
For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all.
Anvils come in different sizes and shapes. Quite often they ge... |
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.
Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of n stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of a1 > a2 > ... > ak > 0 stones. The pile... |
Solve the programming task below in a Python markdown code block.
We had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, ..., sk. After that, in each of these strings we swapped exactly two characters (the characters we swapped could be id... |
Solve the programming task below in a Python markdown code block.
Today you are going to lead a group of elven archers to defend the castle that is attacked by an army of angry orcs. Three sides of the castle are protected by impassable mountains and the remaining side is occupied by a long wall that is split into n s... |
Solve the programming task below in a Python markdown code block.
**
Problem Statement is Updated
**
Xenny had N colors with him, all arranged in a straight line. He was interested in picking up a particular subarray of colors.
A pre-set is a set that contains all subarrays of colors that start from the first color ... |
Solve the programming task below in a Python markdown code block.
Little Raju recently learnt about binary numbers. After spending some time with it, he decided to count in how many ways he can make N digit numbers that is formed by ones and zeroes. But zeroes can not be next to each other. Help him finding in how man... |
Solve the programming task below in a Python markdown code block.
Given an array A. Delete an single element from the array such that sum of the differences of adjacent elements should be minimum.
For more clarification Sum for an array A having N element is defined as :
abs( A[0] - A[1] ) + abs( A[1] - A[2] ) +... |
Solve the programming task below in a Python markdown code block.
You have been given a set of N strings S1, S2, .... SN. Consider any non-empty string S (S need not belong to the given set of N strings). Suppose S occurs (as a substring) in K out of the N given strings in the set. Your job is to choose S such that th... |
Solve the programming task below in a Python markdown code block.
There are N cells arranged in a row, numbered 1, 2, \ldots, N from left to right.
Tak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.
You are given an integer K that is less than or... |
Solve the programming task below in a Python markdown code block.
There are N children, numbered 1,2,\ldots,N. In the next K days, we will give them some cookies. In the i-th day, we will choose a_i children among the N with equal probability, and give one cookie to each child chosen. (We make these K choices independ... |
Solve the programming task below in a Python markdown code block.
You are given a sequence of N integers: A_1,A_2,...,A_N.
Find the number of permutations p_1,p_2,...,p_N of 1,2,...,N that can be changed to A_1,A_2,...,A_N by performing the following operation some number of times (possibly zero), modulo 998244353:
... |
Solve the programming task below in a Python markdown code block.
"Teishi-zushi", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.
Nakahashi entered Teishi-zushi, and he was guided to the counter. Now,... |
Solve the programming task below in a Python markdown code block.
In AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:
* Rating 1-399 : gray
* Rating 400-799 : brown
* Rating 800-1199 : green
* Rating 1200-1599 : cyan
* Rating 1600-1999 : blue
*... |
Solve the programming task below in a Python markdown code block.
N hotels are located on a straight line. The coordinate of the i-th hotel (1 \leq i \leq N) is x_i.
Tak the traveler has the following two personal principles:
* He never travels a distance of more than L in a single day.
* He never sleeps in the open... |
Solve the programming task below in a Python markdown code block.
An English booklet has been created for publicizing Aizu to the world. When you read it carefully, you found a misnomer (an error in writing) on the last name of Masayuki Hoshina, the lord of the Aizu domain. The booklet says "Hoshino" not "Hoshina".
Y... |
Solve the programming task below in a Python markdown code block.
Aizu has an ancient legend of buried treasure. You have finally found the place where the buried treasure is buried. Since we know the depth of the buried treasure and the condition of the strata to be dug, we can reach the buried treasure at the lowest... |
Solve the programming task below in a Python markdown code block.
Playing with Stones
Koshiro and Ukiko are playing a game with black and white stones. The rules of the game are as follows:
1. Before starting the game, they define some small areas and place "one or more black stones and one or more white stones" in ... |
Solve the programming task below in a Python markdown code block.
You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural design competition to find the best design for th... |
Solve the programming task below in a Python markdown code block.
You are working as a night watchman in an office building. Your task is to check whether all the lights in the building are turned off after all the office workers in the building have left the office. If there are lights that are turned on, you must tu... |
Solve the programming task below in a Python markdown code block.
Problem
Aizu Magic School is a school where people who can use magic gather. Haruka, one of the students of that school, can use the magic of warp on the magic team.
From her house to the school, there is a straight road of length L. There are also ma... |
Solve the programming task below in a Python markdown code block.
A small country called Maltius was governed by a queen. The queen was known as an oppressive ruler. People in the country suffered from heavy taxes and forced labor. So some young people decided to form a revolutionary army and fight against the queen. ... |
Solve the programming task below in a Python markdown code block.
There is an evil creature in a square on N-by-M grid (2 \leq N, M \leq 100), and you want to kill it using a laser generator located in a different square. Since the location and direction of the laser generator are fixed, you may need to use several mi... |
Solve the programming task below in a Python markdown code block.
problem
AOR Ika and you came to the tournament-style table tennis tournament singles section for reconnaissance. For AOR Ika-chan, who wants to record all the games, you decide to ask for the number of games that will be played in this tournament.
The... |
Solve the programming task below in a Python markdown code block.
A histogram is made of a number of contiguous bars, which have same width.
For a given histogram with $N$ bars which have a width of 1 and a height of $h_i$ = $h_1, h_2, ... , h_N$ respectively, find the area of the largest rectangular area.
Constrain... |
Solve the programming task below in a Python markdown code block.
Difference of Big Integers
Given two integers $A$ and $B$, compute the difference, $A - B$.
Input
Two integers $A$ and $B$ separated by a space character are given in a line.
Output
Print the difference in a line.
Constraints
* $-1 \times 10^{100... |
Solve the programming task below in a Python markdown code block.
You received a notebook which is called Death Note. This notebook has infinite number of pages. A rule is written on the last page (huh) of this notebook. It says: "You have to write names in this notebook during n consecutive days. During the i-th day ... |
Solve the programming task below in a Python markdown code block.
The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness".
The test consists of n questions; the questions are to be answered... |
Solve the programming task below in a Python markdown code block.
JATC's math teacher always gives the class some interesting math problems so that they don't get bored. Today the problem is as follows. Given an integer n, you can perform the following operations zero or more times:
* mul x: multiplies n by x (wher... |
Solve the programming task below in a Python markdown code block.
The Fair Nut lives in n story house. a_i people live on the i-th floor of the house. Every person uses elevator twice a day: to get from the floor where he/she lives to the ground (first) floor and to get from the first floor to the floor where he/she l... |
Solve the programming task below in a Python markdown code block.
The Kingdom of Kremland is a tree (a connected undirected graph without cycles) consisting of n vertices. Each vertex i has its own value a_i. All vertices are connected in series by edges. Formally, for every 1 β€ i < n there is an edge between the vert... |
Solve the programming task below in a Python markdown code block.
Tokitsukaze is one of the characters in the game "Kantai Collection". In this game, every character has a common attribute β health points, shortened to HP.
In general, different values of HP are grouped into 4 categories:
* Category A if HP is in t... |
Solve the programming task below in a Python markdown code block.
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
Petya has a number consisting of ... |
Solve the programming task below in a Python markdown code block.
You are given a huge integer a consisting of n digits (n is between 1 and 3 β
10^5, inclusive). It may contain leading zeros.
You can swap two digits on adjacent (neighboring) positions if the swapping digits are of different parity (that is, they have... |
Solve the programming task below in a Python markdown code block.
A new delivery of clothing has arrived today to the clothing store. This delivery consists of a ties, b scarves, c vests and d jackets.
The store does not sell single clothing items β instead, it sells suits of two types:
* a suit of the first type ... |
Solve the programming task below in a Python markdown code block.
There is a robot in a warehouse and n packages he wants to collect. The warehouse can be represented as a coordinate grid. Initially, the robot stays at the point (0, 0). The i-th package is at the point (x_i, y_i). It is guaranteed that there are no tw... |
Solve the programming task below in a Python markdown code block.
This is the easy version of the problem. The only difference between easy and hard versions is the constraint of m. You can make hacks only if both versions are solved.
Chiori loves dolls and now she is going to decorate her bedroom!
<image>
As a dol... |
Solve the programming task below in a Python markdown code block.
You might have remembered Theatre square from the [problem 1A](https://codeforces.com/problemset/problem/1/A). Now it's finally getting repaved.
The square still has a rectangular shape of n Γ m meters. However, the picture is about to get more complic... |
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.
A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:
All o... |
Solve the programming task below in a Python markdown code block.
The hobbits Frodo and Sam are carrying the One Ring to Mordor. In order not to be spotted by orcs, they decided to go through the mountains.
The mountain relief can be represented as a polyline with n points (x_i, y_i), numbered from 1 to n (x_i < x_{i... |
Solve the programming task below in a Python markdown code block.
In Fire City, there are n intersections and m one-way roads. The i-th road goes from intersection a_i to b_i and has length l_i miles.
There are q cars that may only drive along those roads. The i-th car starts at intersection v_i and has an odometer ... |
Solve the programming task below in a Python markdown code block.
Input
The input contains two integers a1, a2 (0 β€ ai β€ 109), separated by a single space.
Output
Output a single integer.
Examples
Input
3 14
Output
44
Input
27 12
Output
48
Input
100 200
Output
102
The input will be give
Read t... |
Solve the programming task below in a Python markdown code block.
Berland starts to seize the initiative on the war with Flatland. To drive the enemy from their native land, the berlanders need to know exactly how many more flatland soldiers are left in the enemy's reserve. Fortunately, the scouts captured an enemy in... |
Solve the programming task below in a Python markdown code block.
There is a programming language in which every program is a non-empty sequence of "<" and ">" signs and digits. Let's explain how the interpreter of this programming language works. A program is interpreted using movement of instruction pointer (IP) whi... |
Solve the programming task below in a Python markdown code block.
Vova, the Ultimate Thule new shaman, wants to build a pipeline. As there are exactly n houses in Ultimate Thule, Vova wants the city to have exactly n pipes, each such pipe should be connected to the water supply. A pipe can be connected to the water su... |
Solve the programming task below in a Python markdown code block.
SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is <image> for SmallR while <image> for Zanoes. The one who shoots i... |
Solve the programming task below in a Python markdown code block.
Iahub and Sorin are the best competitive programmers in their town. However, they can't both qualify to an important contest. The selection will be made with the help of a single problem. Blatnatalag, a friend of Iahub, managed to get hold of the proble... |
Solve the programming task below in a Python markdown code block.
Our good friend Mole is trying to code a big message. He is typing on an unusual keyboard with characters arranged in following way:
qwertyuiop
asdfghjkl;
zxcvbnm,./
Unfortunately Mole is blind, so sometimes it i... |
Solve the programming task below in a Python markdown code block.
Vasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.
Let's assume that strings s and t have the same length n, then... |
Solve the programming task below in a Python markdown code block.
Wilbur is playing with a set of n points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (x, y) belongs to the set, then all points (x', y'), such that 0 β€ x' β€ x and 0 β€ y' β€ y also belong to this set.... |
Solve the programming task below in a Python markdown code block.
Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can have 26 distinct nucleotide types, a nucle... |
Solve the programming task below in a Python markdown code block.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' ... |
Solve the programming task below in a Python markdown code block.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of th... |
Solve the programming task below in a Python markdown code block.
Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon from his lab as he pleases.
But Zu... |
Solve the programming task below in a Python markdown code block.
Peter decided to lay a parquet in the room of size n Γ m, the parquet consists of tiles of size 1 Γ 2. When the workers laid the parquet, it became clear that the tiles pattern looks not like Peter likes, and workers will have to re-lay it.
The workers... |
Solve the programming task below in a Python markdown code block.
As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whet... |
Solve the programming task below in a Python markdown code block.
Makes solves problems on Decoforces and lots of other different online judges. Each problem is denoted by its difficulty β a positive integer number. Difficulties are measured the same across all the judges (the problem with difficulty d on Decoforces i... |
Solve the programming task below in a Python markdown code block.
Arkady wants to water his only flower. Unfortunately, he has a very poor watering system that was designed for n flowers and so it looks like a pipe with n holes. Arkady can only use the water that flows from the first hole.
Arkady can block some of th... |
Solve the programming task below in a Python markdown code block.
Two participants are each given a pair of distinct numbers from 1 to 9 such that there's exactly one number that is present in both pairs. They want to figure out the number that matches by using a communication channel you have access to without reveal... |
Solve the programming task below in a Python markdown code block.
Little Chiku is very choosy about numbers. He considers 0 and 1 together as bad omen. So he hates 0 and 1 appearing adjacent to each other. So he wants you to remove these 0 and 1 combinations from a string. So you proceed like this : Choose any two adj... |
Solve the programming task below in a Python markdown code block.
Gudi enters the castle, and moves along the main path. Suddenly, a block in the ground opens and she falls into it! Gudi slides down and lands in a dark room. A mysterious voice announces:
Intruders are not allowed inside the castle. To proceed, you ... |
Solve the programming task below in a Python markdown code block.
Little Shino loves to play with numbers. She just came to know about Fibonacci Series.
Fibonacci Series is a series of number such that
Fib(1) = 0
Fib(2) = 1
Fib(x) = Fib(x-1) + Fib(x-2)\;where\;2 < x
Soon Little Shino realized that Fibonacci series g... |
Solve the programming task below in a Python markdown code block.
Bob loves sorting very much. He is always thinking of new ways to sort an array.His friend Ram gives him a challenging task.He gives Bob an array and an integer K .The challenge is to produce the lexicographical minimal array after at most K-swaps.Only ... |
Solve the programming task below in a Python markdown code block.
A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)
Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price ... |
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
Input is given fro... |
Solve the programming task below in a Python markdown code block.
Given are N points on the circumference of a circle centered at (0,0) in an xy-plane. The coordinates of the i-th point are (\cos(\frac{2\pi T_i}{L}),\sin(\frac{2\pi T_i}{L})).
Three distinct points will be chosen uniformly at random from these N point... |
Solve the programming task below in a Python markdown code block.
We have A apples and P pieces of apple.
We can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.
Find the maximum number of apple pies we can make with what we have now.
Constraints
* All valu... |
Solve the programming task below in a Python markdown code block.
There is always an integer in Takahashi's mind.
Initially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is `+` or `-`. When he eats `+`, the integer in his mind increases by 1; when he eats `-`, the in... |
Solve the programming task below in a Python markdown code block.
You are going out for a walk, when you suddenly encounter a monster. Fortunately, you have N katana (swords), Katana 1, Katana 2, β¦, Katana N, and can perform the following two kinds of attacks in any order:
* Wield one of the katana you have. When you... |
Solve the programming task below in a Python markdown code block.
You are given a tree with N vertices.
Here, a tree is a kind of graph, and more specifically, a connected undirected graph with N-1 edges, where N is the number of its vertices.
The i-th edge (1β€iβ€N-1) connects Vertices a_i and b_i, and has a length of ... |
Solve the programming task below in a Python markdown code block.
There is a square-shaped grid with N vertical rows and N horizontal columns. We will denote the square at the i-th row from the top and the j-th column from the left as (i,\ j).
Initially, each square is either white or black. The initial color of the ... |
Solve the programming task below in a Python markdown code block.
n! = n Γ (n β 1) Γ (n β 2) Γ ... Γ 3 Γ 2 Γ 1
Is called the factorial of n. For example, the factorial of 12
12! = 12 x 11 x 10 x 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 479001600
And there are two consecutive 0s at the end.
Write a program that inputs t... |
Solve the programming task below in a Python markdown code block.
White Tiger University holds a programming contest every year. The contest starts with a score of 0 for all teams, and points are added according to the answer status. In this contest, rankings will be made in descending order of score. When the total n... |
Solve the programming task below in a Python markdown code block.
The deadline of Prof. Hachiojiβs assignment is tomorrow. To complete the task, students have to copy pages of many reference books in the library.
All the reference books are in a storeroom and only the librarian is allowed to enter it. To obtain a cop... |
Solve the programming task below in a Python markdown code block.
Arithmetic Progressions
An arithmetic progression is a sequence of numbers $a_1, a_2, ..., a_k$ where the difference of consecutive members $a_{i+1} - a_i$ is a constant ($1 \leq i \leq k-1$). For example, the sequence 5, 8, 11, 14, 17 is an arithmetic... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.