task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Dagatal Description: ## Input One line with a single integer $m$, the number of the month. It will hold that $1 \leq m \leq 12$. ## Output A single line with one integer, the number of days in month number $m$. ## Scoring Group Points Constraints 1 100 No further constraints **Sample Input 1** ...
27,100
Daily Division Description: Oostende Beach is a very long beach located in the north of Belgium. On this beach, there are $n$ huts located along a straight line. People can rent a room in one of those huts to spend their beach vacations together with the other tenants. Every day at lunch time, a food truc...
27,101
Dalarna Description: Dalarna’s road network consists of $N$ cities and $N-1$ roads. Each road directly connects two cities. If a taxi is in a city, it can travel to all cities that are directly connected to it via a road. Furthermore, the network is constructed so that it is always possible to travel b...
27,102
Damaged Equation Description: The scientists Mildra and Gloisa have been responsible for exploring Luyten 726-8, but have ended up with an issue: Their fusion reactor has stopped working! In order to continue their work, they need to get some materials from the closest asteroid. To do that though, they...
27,103
Dams in Distress Description: Freyr, being the god of rain, knows exactly how much water is needed to wash the war camp away, and for each dam knows its exact capacity and how much water is currently stored there. Freyr, also being the god of prosperity and harvest, has better things to do than making ...
27,104
Dance Description: The line outside the city’s most popular Lindy Hop venue is longer than ever! Because security and coat checking takes significant time, the music and dancing starts as soon as the first couple hits the floor, even though most couples are still standing in line. Although Lindy Hop i...
27,105
Dance Circle Description: It’s Halloween, and you’ve organized a bonfire and dance for the neighborhood children. The $n$ children have gathered into a ring to dance around the fire. Each child is wearing one of two fun yet spooky costumes: orange pumpkin, or black bat. Since it’s dark outside, you can...
27,106
Dance Pad Description: A dance pad consists of four arrows pointing up, right, down and left. When playing a dance game you are given a sequence of arrows to step on to the beat of the music. Sometimes two arrows can be shown for the same beat, so you have to make a jump to step on them. You can always...
27,107
Dance Recital Description: The Production Manager of a dance company has been tasked with determining the cost for the seasonal dance recital. Because of their exceptional skills, many dancers will perform in more than one routine, but this presents a problem; each dance routine incorporates a unique c...
27,108
Dance Reconstruction Description: Marek loves dancing and he has danced a lot in the last couple of years. He has actually danced so much that he became too good in all of the traditional dances like swing, salsa, ballroom and hip-hop and now all partners he dances with can not keep up with him. Theref...
27,109
Dance Reconstruction (Hard) Description: Note that this is a harder version of problem dance. The change to the previous version is marked in bold. Marek loves dancing and he has danced a lot in the last couple of years. He has actually danced so much that he became too good in all of the traditional danc...
27,110
Dangerous Skiing Description: Lukáš starts at the top of the mountain, and wants to get to the bottom. There are $N$ small cabins scattered along the mountainside, numbered $0$ to $N-1$. He will always go from one cabin to another, along certain pistes. For each piste, which always connects exactly...
27,111
Danish Description: Boschua is moving to Lund to study at LTH. You’ve learned that Lund is in Skåne, and now you’re worried that Boschua might start sounding Danish. To prevent this, you want to show Boschua how many words don’t sound Danish at all. According to you, a word sounds Danish if it contain...
27,112
Dans Description: When Forritunarkeppni Framhaldsskólanna was held in the 19th century the traditions were different than today. For example all candy was considered evil. The contest was held along with Þorrablót and contestants ate Þorramatur while the contest was ongoing, each bite of shark being co...
27,113
Dansgólf Description: Haven’t you seen the new dancefloor at Vestur? It’s the hottest thing in town these days and the youth wait in long queues to get a spot at the dancefloor to dance! Despite the high traffic recently, business hasn’t been going well at Vestur and they’re looking for all kinds of ways ...
27,114
Daring Don't Description: Rainbow Dash and Daring Do have rushed into the Fortress of Talacon, and they need to solve an ancient puzzle to open the doorway to the treasure of the fortress, a large golden ring. The puzzle consists of a large grid on the floor, having $R$ rows and $C$ columns. Each cell...
27,115
Daring Doubt Description: There are two sides to every story. Last year, you heard Daring Do’s. But what about Dr. Caballeron’s? Daring Do and Dr. Caballeron had both raced to Tenochtitlan, originally seeking to acquire the Truth Talisman of Tonatiuh for their own reasons. The mysterious artifact was not...
27,116
Dark Alley Description: The alley can be modelled as a line with a length of $n$ metres. The fog has a uniform density and reduces the light of a lamp by a factor of $1-p$ every metre. The brightness at one point is the sum of the light that reaches this point from every lamp. You want to calculate...
27,117
Dart Scoring Description: You have invented a new form of the game of darts, and it is based on the idea that the tightest cluster of darts wins — but they don’t necessarily have to be close to a target. In fact, the game is easy to play because it doesn’t require a target; players can just throw darts...
27,118
Dartboard Description: Jaap is playing darts at the local pub with a group of friends. His darts throwing skills are not that great, so he just tries to aim at the center of the dartboard. His mathematical skills are better though, and he wonders what is his expected score for one dart. After a while ...
27,119
Darts Description: After a long week of work at the ICPC Headquarters, Bill and his friends usually go to a small pub on Friday evenings to have a couple of beers and play darts. All of them are well aware of the fact that their ability at darts decreases at the same rate as the amount of beer left in ...
27,120
Darts Description: Consider a game in which darts are thrown at a board. The board is formed by $10$ circles with radii $20$, $40$, $60$, $80$, $100$, $120$, $140$, $160$, $180$, and $200$ (measured in millimeters), centered at the origin. Each throw is evaluated depending on where the dart hits th...
27,121
Das Blinkenlights Description: There are two lights that blink at regular intervals. When each one blinks, it turns on and then immediately back off; they don’t toggle. They are both off at time $t = 0$. The first one blinks at $t=p, 2p, 3p, \ldots $ seconds; the second one blinks at $t=q, 2q, 3q, \ldo...
27,122
Data Race Description: You have $T$ threads that are writing to a circular data structure with $N$ positions (each position storing a single integer), and all of the threads write $1$ integer per second. Each thread $i$ starts writing at time $t_ i$, from position $p_ i$ in the data structure, ...
27,123
Date Picker Description: As a computer scientist, you plan your meetings only on whole hours and each meeting takes an integer number of hours. Therefore, your agenda can be modelled as a matrix of $7$ rows (days), and $24$ columns (hours). Each cell in this matrix is either ‘.’ or ‘x’, meaning...
27,124
Date Pickup Description: Richard and Janet are going on their first date. Richard has offered to meet her at home with his bicycle, and Janet tells him she will call when she is ready in $10$ to $20$ minutes. But Richard is an impatient person; while he could wait at home for Janet’s signal, he might a...
27,125
Dating time Description: Our two lovebirds, Banmuon and Henho want to go on a date. However, they are afraid that their friends or families may find out. Thus, they have decided to setup their dating time using the following secret methods: * Banmuon will send Henho a string with format h1:m1 h2:m2 alpha ...
27,126
Datum Description: Write a program that, given a date in $2009$, determines the day of week on that date. ## Input The first line contains two positive integers $D$ (day) and $M$ (month) separated by a space. The numbers will be a valid date in $2009$. ## Output Output the day of the week on day $D$ of mon...
27,127
Daydreaming Stockbroker Description: Now Gina starts to wonder: if she were to go back in time a few days and bring a measly $\$ 100$ with her, how much money could she make by just buying and selling stock in Rollercoaster Inc. (the most volatile stock in existence) at the right times? Would she earn ...
27,128
Daylight Saving Time Description: Daylight Saving Time (DST) is the practice of advancing clocks forward during the summer time, usually by one hour, to gain an extra hour of sunlight in the evenings, at the cost of darker mornings. Countries and regions have changed their DST practices over the years,...
27,129
Dead Fraction Description: To make this tenable, he assumes that the original fraction is always the simplest one that produces the given sequence of digits; by simplest, he means the the one with smallest denominator. Also, he assumes that he did not neglect to write down important digits; no digit fr...
27,130
Dead-End Detector Description: The road map is a collection of locations connected by two-way streets. The following rule describes how to obtain a complete placement of dead-end signs. Consider a street $S$ connecting a location $x$ with another location. The $x$-entrance of $S$ gets a dead-en...
27,131
Death Knight Hero Description: There once was a champion of WoW Arthasdk the name he was bestowed He Death Gripped you to his side His Chains of Ice stopped your stride And Obliterates made you say “OWW!” But one day our hero got puzzled His Death Grip totally fizzled In his darkest despair He...
27,132
Death and Taxes Description: In Taxmania dead cats are prohibited from owning stock, so when Mittens died, all her shares (units) of stock in Mittens Conglomerated were sold, with $30\% $ of the capital gains paid as taxes. Your task is to compute how much money the final sale of Mittens’ shares yields...
27,133
Deathstar Description: Young jedi Ivan has infiltrated in The Death Star and his task is to destroy it. In order to destroy The Death Star, he needs an array of non-negative integers $a_ i$ of length $N$ that represents the code for initiating the self-destruction of The Death Star. Ivan doesn’t have t...
27,134
Debellatio Description: “I’m never satisfied unless I get the last word.” ­–Alan Dershowitz. When representing their clients in front of a clueless jury, seasoned lawyers know that rhetoric can be just as, if not more, important than actual substance. It is imperative to make the other side look like ...
27,135
Debug Description: While debugging a program Mirko noticed that a bug in the program may be linked with the existence of so called square killers in the program memory. The program memory is a matrix composed of $R$ rows and $C$ columns consisting only of zeroes and ones. A square killer is a squar...
27,136
Debugging Description: So you and your printf are now on your own in the search for a line of code that causes the release build to crash. Still you are lucky: adding printf statements to this program affects neither the bug (it still crashes at the same original code line) nor the execution time (at l...
27,137
Decelerating Jump Description: An athlete is participating in a new sport that is the perfect mix of hopscotch and triple jumping. For this jury sport, $n$ squares are laid out on the ground in a line, with equal distances between them. The first phase is the approach, where an athlete sprints towa...
27,138
Deceptive Dice Description: Recently your town has been infested by swindlers who convince unknowing tourists to play a simple dice game with them for money. The game works as follows: given is an $n$-sided die, whose sides have $1, 2, \ldots , n$ pips, and a positive integer $k$. You then roll the...
27,139
Deceptive Directions Description: You find yourself on a remote island, searching for a legendary lost treasure. However, despite having gotten your hands on directions leading straight to the treasure, you have a problem. It turns out you have a saboteur in your expedition, and that at some point they...
27,140
Decimal deletion Description: After solving one too many optimisation problems, Joshua has developed a phobia for floating point numbers. Help him out by rounding some floating point numbers into normal, safe integers. ## Input The first and only line of input will be a decimal number $0\leq N \leq 1...
27,141
Decision Making Description: After getting introduced to gambling by your friends, you decided to try your luck at the casino. There, you encountered a very interesting game! The game is played with a single coin and a set of $n$ strings $s_1, s_2, \ldots , s_ n$ consisting of the characters H and T. ...
27,142
Decisions, Decisions Description: Let $x_0, \ldots , x_{n-1}$ denote $n$ boolean variables (i.e., variables taking only values $0$ and $1$). A binary decision diagram (BDD) over these variables is a diagrammatic representation of a boolean function $f(x_0, \ldots , x_{n-1})$ as inputs. A BDD i...
27,143
Deck Randomisation Description: Alice and Bob love playing Don’tminion, which typically involves a lot of shuffling of decks of different sizes. Because they play so often, they are not only very quick at shuffling, but also very consistent. Each time Alice shuffles her deck, her cards get permuted in ...
27,144
Decoding the Hallway Description: Edward is now 21 years old. He has to appear in an exam to renew his State Alchemist title. This year the exam is arranged in a bit different way. There will be a long hallway. Each alchemist will enter the hallway from the left side and come out from the right side an...
27,145
Decorative Dominoes Description: Marie likes Dominoes. She is too young to fully understand the game, so she just creates arrangements based on the following simple rule: Each of the two ends of a domino must be adjacent to an end of another domino with the same number on it. Today, Marie found a larg...
27,146
Deduplicating Files Description: Computer filesystems are often filled with multiple copies of identical files. These identical files take up unnecessary space, since one copy, plus appropriate file system links, are sufficient to represent all the copies. A simple way to combat this problem is to comp...
27,147
Deild Goðsagnanna Description: The members of the Competitive Programming Association of Iceland play League of Legends quite a lot. In League of Legends there are two teams, the blue team and the red team, each of which consists of five players. Each player picks one of the available champions to play...
27,148
Deildadrottnun Description: The government is currently examining the universities’ finances. Last contest had you follow a system in which all departments got the same amount of money. This along with some other constraints made it such that some money went unused, which clearly has to be fixed. This ...
27,149
Deildajöfnuður Description: The dean of the university is organizing the finances of the university. The ministry of education provides financial support, according to a well defined government policy. The ministry finances the university by offering some number of grants. At the university there are $...
27,150
Dejavu Description: $N$ points are placed in the coordinate plane. Write a program that calculates how many ways we can choose three points so that they form a right triangle with legs parallel to the coordinate axes. A right triangle has one 90-degree internal angle. The legs of a right triangle are...
27,151
Delete This! Description: Well, it’s time. Andrew has been accumulating file after file on his computer and could never bring himself to delete any single one of them (“You know Algol might make a comeback, so I better not delete any of those files” is one of a large number of his justifications). But ...
27,152
Delft Distance Description: Since you are already late for the contest start, you need to find a shortest path from your hotel to the contest site. Fortunately, you have a map of the city. See Figure 1 for an example. ## Input The input consists of: * One line with two integers $h$ and $w$ ($1 \leq h,w ...
27,153
Delicious Bubble Tea Description: Bubble Tea is now one of the most popular drink in Vietnam. Nowadays, walking down on the street, you can find a bubble tea shop everywhere. A huge number of bubble tea brands have arrived: Bobapop, Chago, DingTea, GongCha, Mr.GoodTea, RoyalTea, ToCoToCo,… Bubble tea a...
27,154
Delimiter Soup Description: Whenever a programmer starts to learn a Lisp, they think that there are too many parentheses in it. Sophia thinks there are too few, so she is making a programming language with only parentheses. To spice it up a bit, she is also adding square brackets (‘[]’) and curly brace...
27,155
Delivering Goods Description: The road network consists of one-way streets between junctions. The warehouse and clients are all located at a junction. You know the driving time across each street. You guarantee extremely fast shipping: the trucks start driving immediately at the start of the day and each ...
27,156
Delivering the Bread Description: Kiki has taken the odd job of delivering bread across the entire globe! She is currently passing through a group of cities on the equator. The equator has a total distance of $D$, with positions labeled $0$ to $D-1$. Kiki only moves one step in the positive direction ...
27,157
Delivery Delays Description: Even though Holly’s delivery car can hold an arbitrary number of pizzas, she has not been able to keep up with the large number of orders placed, meaning they have had to give away a number of pizzas due to late deliveries. Trying to figure out the best way to fix the situatio...
27,158
Demerit Points Description: A province to our west, which shall remain nameless, but whose name does not start with A, B, or S, has a unique system for driver’s license demerit and merit points. The system works (more or less) as follows. A new driver starts with no merit or demerit points. When the d...
27,159
Derangement Rotations Description: A Derangement is a permutation $p$ of ${1, 2, \ldots , n}$ where $p_ i \ne i$ for all $i$ from $1$ to $n$. A rotation of a sequence $a_1, a_2, \ldots , a_ n$ with offset $k$ ($1 \le k \le n$) is equal to the sequence $a_ k$, $a_{k+1}$, $\ldots $, $a_ n$, $a_1$, $...
27,160
Desiigner strengir Description: Arnar recently went to a concert hosting several rappers. There he discovered his new favourite rapper, Desiigner. But he struggled to make out the words he was saying, his rapping was very fast and unclear. But he heard him say a particular word quite frequently, one st...
27,161
Destination Unknown Description: You are agent B100. A pair of prominently dressed circus artists is traveling over the roads of the city and your mission is to find out where they are headed. All we know is that they started at point $s$ and that they are heading for one of several possible destinatio...
27,162
Detailed Differences Description: One of the most basic problems in information processing is identifying differences between data. This is useful when comparing files, for example. For this problem, write a program which identifies the differences between pairs of strings to make it easier for humans ...
27,163
Determining Nucleotide Assortments Description: Genes ’R Us specializes in analyzing strands of DNA to look for anomalies, matches, patterns, or whatever specific items their customers are interested in. You may recall from high school biology that the DNA molecule consists of two chains wrapped around...
27,164
Deterministic Finite Automata - Complement Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$ You should output the complement, a deterministic finite automaton that accepts the language $\overline{\mathcal{L}}$. ## Input The first line of inputs contains ...
27,165
Deterministic Finite Automata - Concatenation Description: You are given two deterministic finite automata that accept the languages $\mathcal{L}_1$ and $\mathcal{L}_2$. You should output the concatenation, a deterministic finite automaton that accepts the language $\mathcal{L} = \mathcal{L}_1\mathcal{...
27,166
Deterministic Finite Automata - Difference Description: You are given two deterministic finite automata that accept the languages $\mathcal{L}_1$ and $\mathcal{L}_2$. You should output the difference, a deterministic finite automaton that accepts the language $\mathcal{L} = \mathcal{L}_1 \setminus \mat...
27,167
Deterministic Finite Automata - Enumeration Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You will then be given queries asking for the number of words in $\mathcal{L}$ with a specified length, which you should answer in the order they are given. ## I...
27,168
Deterministic Finite Automata - Intersection Description: You are given two deterministic finite automata that accept the languages $\mathcal{L}_1$ and $\mathcal{L}_2$. You should output the intersection, a deterministic finite automaton that accepts the language $\mathcal{L} = \mathcal{L}_1 \cap \math...
27,169
Deterministic Finite Automata - Is a Finite Language? Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You should output whether $\mathcal{L}$ is a finite language. ## Input The input contains the description of a deterministic finite automaton. Th...
27,170
Deterministic Finite Automata - Is the Empty Language? Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You should output whether $\mathcal{L}$ is the empty language. ## Input The input contains the description of a deterministic finite automaton. ...
27,171
Deterministic Finite Automata - Kleene Star Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You should output the Kleene star, a deterministic finite automaton that accepts the language $\mathcal{L}^{\ast }$. ## Input The input contains the descrip...
27,172
Deterministic Finite Automata - Maximum Word Length Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You should output the length of the longest word $w$ such that $w \in \mathcal{L}$. You may assume that $\mathcal{L}$ is non-empty. ## Input The inp...
27,173
Deterministic Finite Automata - Minimum Word Length Description: You are given a deterministic finite automaton that accepts the language $\mathcal{L}$. You should output the length of the shortest word $w$ such that $w \in \mathcal{L}$ is a finite language. You may assume that $\mathcal{L}$ is non-empty. ...
27,174
Deterministic Finite Automata - Read Description: You are given a deterministic finite automaton and a list of strings. For each string given, you should determine whether the automaton accepts or rejects the string. ## Input The first line of input contains four positive integers $n$, $c$, $s$, and $f$,...
27,175
Deterministic Finite Automata - Symmetric Difference Description: You are given two deterministic finite automata that accept the languages $\mathcal{L}_1$ and $\mathcal{L}_2$. You should output the symmetric difference, a deterministic finite automaton that accepts the language $\mathcal{L} = \mathcal...
27,176
Deterministic Finite Automata - Union Description: You are given two deterministic finite automata that accept the languages $\mathcal{L}_1$ and $\mathcal{L}_2$. You should output the union, a deterministic finite automaton that accepts the language $\mathcal{L} = \mathcal{L}_1 \cup \mathcal{L}_2$. ##...
27,177
Detour Description: After last year’s edition of the BAPC, you are still stuck in Delft. In order to participate again this year, you are going to Amsterdam by bus. During the journey you look out of the window and look for traffic signs that point in the direction of Amsterdam. To your surprise, you n...
27,178
Diagonal Cut Description: Quido and Hugo are making a chocolate cake. The central ingredient of the cake is a large chocolate bar, lying unwrapped on the kitchen table. The bar is an $M \times N$ rectangular grid of chocolate blocks. All of the $MN$ blocks are rectangles of identical shape and size. Th...
27,179
Diagonals Description: Diagonals is a pencil puzzle which is played on a square grid. The player must draw a diagonal line corner to corner in every cell in the grid, either top left to bottom right, or bottom left to top right. There are two constraints: * Some intersections of gridlines have a number fr...
27,180
Dice Betting Description: Gunnar and his friends like games which involve rolling dice. Gunnar has a huge collection of 6-sided, 12-sided and 20-sided dice. All the games with dice started to bore him, so he came up with a new game. He rolls an $s$-sided die $n$ times and wins if at least $k$ different...
27,181
Dice Cup Description: In many table-top games it is common to use different dice to simulate random events. A “d” or “D” is used to indicate a die with a specific number of faces, d4 indicating a four-sided die, for example. If several dice of the same type are to be rolled, this is indicated by a ...
27,182
Dice Game Description: Gunnar and Emma play a lot of board games at home, so they own many dice that are not normal $6$-sided dice. For example they own a die that has $10$ sides with numbers $47, 48, \ldots , 56$ on it. There has been a big storm in Stockholm, so Gunnar and Emma have been stuck a...
27,183
Dice Grid Description: Simon has an unusually large amount of dice, owing to his love for the game Liar’s dice which requires just that. This has resulted in Simon inventing a large number of new games concerning dice. His newest one is called Dice Grid. Dice Grid is a single-player game, where the go...
27,184
Dice Results Description: You are given a set of dice which will be thrown. Each die has some number of sides $H$ and all sides are equally likely to be the result when the die is thrown. If a die has $H$ sides the numbers on the sides are $1, 2, \dots , H$. Find the probability distribution of the...
27,185
Dice and Ladders Description: The ladder game is a fun children’s game, the rules are as follows: You start at cell number 1 and each round you roll a dice and move the number specified by the dice. If you end on a cell with a ladder starting from this cell then you have to follow the ladder in its dir...
27,186
Dick and Jane Description: Dick is $d=12$ years old. When we say this, we mean that it is at least twelve and not yet thirteen years since Dick was born. Dick and Jane have three pets: Spot the dog, Puff the Cat, and Yertle the Turtle. Spot was $s$ years old when Puff was born; Puff was $p$ years old ...
27,187
Dictionary Attack Description: In choosing a password, it’s important to avoid dictionary words or simple variants of them. Using a password based on a dictionary word makes it easier for an attacker to break into your account by simply guessing dictionary words and similar strings. We say that a pass...
27,188
Dictionary Compression Description: In the menu to the right, you are able to download an English dictionary (dict.txt) containing a sorted list of words, one per line. Your task is to write a program that outputs a prefix of the dictionary that is as long as possible. ## Input There is no input for ...
27,189
Die Hard Description: John and Hans are playing a game involving 3 dice. Even though they are all 6-sided, they are not guaranteed to be identical. First John picks one of the dice and then Hans picks one of the remaining two. Then they both roll their chosen die. If they roll the same number, they bo...
27,190
Difference Description: A smallest different sequence (SDS) is a sequence of positive integers created as follows: $A_1=r \geq 1$. For $n>1$, $A_ n=A_{n-1}+d$, where $d$ is the smallest positive integer not yet appearing as a value in the sequence or as a difference between two values already in the sequen...
27,191
Different Distances Description: Some people say ‘The shortest distance between two points is a straight line.’ However, this depends on the distance metric employed. Between points $(x_1,y_1)$ and $(x_2,y_2)$, the Euclidean (aka straight-line) distance is However, other distance metrics are often useful....
27,192
Digbuild Description: Most of us like playing video games. Benni prefers to play the video game Digbuild. Digbuild is primarily about surviving for as long as possible. In the game almost everything is possible. You can climb mountains, build castles, and fish, just to name a few options. The gameworld...
27,193
Digi Comp II Description: One can “program” this machine by specifying the graph structure, the initial states of each switch vertex and the number of balls that enter. The result of the computation is the state of the switches at the end of the computation. Interestingly one can program quite sophisti...
27,194
Digit Division Description: We are given a sequence of $n$ decimal digits. The sequence needs to be partitioned into one or more contiguous subsequences such that each subsequence, when interpreted as a decimal number, is divisible by a given integer $m$. Find the number of different such partitions modul...
27,195
Digit Product Description: Consider a positive integer $x$. Multiply its nonzero digits and you get another integer $y$. Repeating this process, you eventually arrive at a single digit between $1$ and $9$. Write a program that reads $x$ and outputs the resulting digit. ## Input An integer $x$ with ...
27,196
Digit Sum Description: For a pair of integers $a$ and $b$, the digit sum of the interval $[a, b]$ is defined as the sum of all digits occurring in all numbers between (and including) $a$ and $b$. For example, the digit sum of $[28,31]$ can be calculated as: Given the numbers $a$ and $b$, c...
27,197
Digit Sum Description: Given an integer N, find the smallest integer with the same digit sum which is greater than N. The digit sum of an integer is the sum of its digits, For exempel, the digit sum of $9550$ is $9 + 5 + 5 + 0 = 19$ and the digit sum of $999$ is $9 + 9 + 9 = 27$. ## Input An integer, N....
27,198
Digit Swap Description: Ann Britt-Caroline has a safe with a 2-digit code. Occasionally, she types in the code too fast, accidentally swapping the positions of the two digits. She has asked if you could program her safe to check if not only the 2-digit code she entered was correct, but if the code with...
27,199