Curated sets

Math and counting

Number theory, combinatorics, and geometry.

All problems
Total results6,670 problems
TopicsJudge
Find MultiplesRead n, then read numbers until a sentinel 0, printing for each whether it is a multiple of n.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Number Card GameFor each starting number S, repeatedly replace it with the product of its digits until a single digit appears, printing every value in order.Easy2SimulationImplementation+2No attempts yet1s128 MBJudgeable
Pizza PricingFor each menu of pizzas, find the diameter of the pizza with the lowest cost per square inch.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
QuicksumCompute a weighted checksum for each input line: sum each character's 1-based position times its letter value, where spaces count as 0, until a line with only #.Easy2StringImplementation+2No attempts yet1s128 MBJudgeable
St. IvesFor each floating-point n until a terminating 0, print 1 + n + n^2 + n^3 + n^4 rounded to two decimals.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Fifty Coats of GrayGiven room dimensions, opening sizes, and the area one can covers, compute the total paintable area for n apartments and round up to whole cans.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Roaming RomansConvert each English-mile distance into Roman miles and paces using a fixed ratio, rounding the pace count to the nearest integer.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
The Twin ParadoxGiven Earth time and spaceship time, compute the ship's average speed as a fraction of light speed and print it to three decimals.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Parlay WageringSimulate a sequence of parlay wagers: apply each money-line multiplier with truncation, skip ties, and format the final payout with commas.Easy2SimulationImplementation+1No attempts yet1s128 MBJudgeable
General Chemistry LabGiven a sequence of temperatures ending with 999, print each temperature's difference from the previous one, rounded to two decimals.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Financial ManagementGiven twelve monthly closing balances, compute the mean and print it rounded to the nearest penny with a dollar sign.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Tire DimensionsParse a tire size code and compute its overall circumference from the section width, aspect ratio, and rim diameter.Easy2StringImplementation+1No attempts yet1s128 MBJudgeable
Next NumberGiven three distinct integers from an arithmetic or geometric progression, decide which type it is and print the label with the next term.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
FIFA World CupGiven groups, teams per group, advancers per group, and byes, compute total matches played plus teams padded to the next power of two.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Number Guessing GameFor each n0, report whether 3*n0 is odd or even and print n4, the quotient of (n2*3)/9.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Judging OlympiaFor each line of six judge grades, discard the highest and lowest and print the average of the remaining four, stopping at the all-zero line.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Being Smarty!Given row R and block size N, decide whether the alternating style property P1 or P2 applies to that row.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
The Euclidean ClockGiven two clock times and a radius, find the area of the sector swept by the hour hand between them.Easy2MathGeometry+1No attempts yet1s128 MBJudgeable
ICPC Score Totalizer SoftwareFor each contestant, drop one highest and one lowest judge score, then output the truncated average of the rest.Easy2ImplementationSorting+2No attempts yet1s128 MBJudgeable
SavingsFor each test case, print how many years of multiplying the balance by (1 + B/100) are needed until it first exceeds M.Easy2SimulationMath+2No attempts yet1s128 MBJudgeable
Jean and Joe's ClothesRead clothing sizes and count how many items go to Joe, Jean, Jane, James, or no one, per visit until N equals 0.Easy2ImplementationSimulation+2No attempts yet1s128 MBJudgeable
RecipesMultiply each recipe amount by a constant and print the result as a reduced integer or mixed fraction.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Map InterfaceGiven station coordinates and a visited sequence, count how many stations fall inside the smallest axis-aligned rectangle covering the visited stations.Easy2ArrayImplementation+2No attempts yet1s128 MBJudgeable
Bailout BonusGiven a list of bailed-out companies, a tax rate, and executives with company and bonus, sum the floor of the taxed fraction for executives at bailed companies.Easy2ImplementationHash map+2No attempts yet1s128 MBJudgeable
Isn't It Funny How a Bear Likes Honey?Given Pooh's weight and the radii of several spherical helium balloons, decide whether their combined lift strictly exceeds his weight.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Civil EngineeringRead material densities and oblong dimensions, then sum each oblong's volume times its material density for each data set.Easy2ImplementationMath+2No attempts yet1s128 MBJudgeable
Aerospace & Mechanical EngineeringGiven each stage's mass, burn time, and thrust, simulate the rocket's vertical motion and report its height when the last stage falls off.Easy2SimulationImplementation+1No attempts yet1s128 MBJudgeable
Alphabet DistanceFor each test case, read two equal-length uppercase words and print the alphabet distance between the paired letters at every position.Easy2StringImplementation+1No attempts yet1s128 MBJudgeable
Vigenère CipherEncrypt each given plaintext with the Vigenère cipher, shifting every letter by the aligned repeated keyword letter modulo 26.Easy2StringImplementation+1No attempts yet1s128 MBJudgeable
Stacked Floating MountainsGiven several sequences, decide for each whether every element from the third onward equals the sum of the two before it.Easy2ImplementationArray+1No attempts yet1s128 MBJudgeable
Counting Swann's CoinsPrint numbers 1 through N, replacing multiples of 3 with Dead, of 5 with Man, and of 15 with DeadMan, breaking the line after each word.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Fill the Rowboats!Print the numbers 1 through N, inserting the word Go! after every sixth number and after the last one.Easy2ImplementationSimulation+1No attempts yet1s128 MBJudgeable
Greatest Common DivisorRead n pairs of positive integers and print the greatest common divisor of each pair on its own line.Easy2MathNumber theory+1No attempts yet1s128 MBJudgeable
Least Common MultipleFor each of n test cases, read two natural numbers a and b and print their least common multiple.Easy2MathNumber theory+1No attempts yet1s128 MBJudgeable
Mars MathEvaluate a chain of at most three Mars operations (@, %, #) on a starting number and print the result to two decimals.Easy2SimulationImplementation+1No attempts yet1s128 MBJudgeable
Escape RouteGiven your position and n-1 planet positions, find the closest planet, print both coordinates, and print the distance rounded to two decimals.Easy2Brute forceMath+1No attempts yet1s128 MBJudgeable
Annoying MosquitosGiven up to 100 mosquito positions and up to 10000 swat centers, count how many mosquitos fall within the 101x101 square of at least one swat.Easy2Brute forceImplementation+1No attempts yet1s256 MBJudgeable
Vacation HomeworkGiven L vacation days and per-day limits C and D, find the most free days after finishing A Korean and B math pages.Easy2MathGreedy+1No attempts yet1s128 MBJudgeable
Time CardGiven clock-in and clock-out times for three employees in h m s form, print each employee's working duration as hours, minutes, and seconds.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
ChangeGiven a purchase amount below 1000 yen paid with a 1000-yen bill, find the minimum number of coins in the change.Easy2GreedyMath+1No attempts yet1s128 MBJudgeable
Caesar CipherGiven an uppercase word encrypted by shifting each letter forward three positions, shift every letter back by three to recover the original.Easy2StringImplementation+2No attempts yet1s128 MBJudgeable
Triangle Validity and ClassificationRead lines of three side lengths, count valid triangles as right, acute, or obtuse, and stop at the first line that is not a triangle.Easy2ImplementationMath+2No attempts yet1s128 MBJudgeable
Hailstone SequencesFor each starting value H up to 500, simulate the Collatz rule and print the largest number that appears before reaching 1.Easy2SimulationImplementation+1No attempts yet1s128 MBJudgeable
Factorial BaseRead each factorial-base number, weight digit at position i (from the right, 1-indexed) by i!, and print the decimal value.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Jingle ComposingSplit a slash-delimited composition into measures and count how many note durations sum exactly to 1.Easy2StringImplementation+1No attempts yet1s128 MBJudgeable
FeynmanFor each N, count all axis-aligned squares contained in an N by N grid of unit cells, ending at the sentinel 0.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Contest TimingShe starts at 11:11 on 11/11. Given the day, hour, and minute she stops, print the minutes elapsed, or -1 if the stop is earlier.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Math PracticeGiven A (0 to 45) and B (1 to 9), find the smallest E in 1 to 62 with E > A and 2^E starting with digit B, or 0 if none exists.Easy2MathBrute force+1No attempts yet1s128 MBJudgeable
Odd or EvenRead N large integers up to 10^60 and print odd or even for each, judging parity from the last digit.Easy2StringMath+2No attempts yet1s128 MBJudgeable
Scavenger HuntList every pair (x, y) where x divides P and y divides Q, sorted by x then y.Easy2MathBrute force+1No attempts yet1s128 MBJudgeable
StatisticsRead N integers, print their mean and median rounded to six decimal places.Easy2ArraySorting+2No attempts yet1s128 MBJudgeable
Color Me LessRead 16 target RGB colors, then map each following color to the nearest target color by Euclidean distance, breaking ties by earliest appearance.Easy2ImplementationBrute force+2No attempts yet1s128 MBJudgeable
Approximating ePrint approximations of e for n from 0 to 9, each rounded to 9 decimals with trailing zeros removed, under a fixed two-line header.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Getting ChordedGiven three note names, decide whether their semitone spacing forms a major or minor chord, then print the echo with the root-named chord or "unrecognized".Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
GolfFor each test case, turn a hole's par and John's stroke count into the standard golf score name, with hole-in-one taking priority.Easy2ImplementationMath+2No attempts yet1s128 MBJudgeable
PerfectionFor each number below 60000, sum its proper divisors and classify it as perfect, deficient, or abundant.Easy2MathNumber theory+1No attempts yet1s128 MBJudgeable
Ballot EvaluationSum the given parties' vote percentages and check the sum against an integer n using the guess's comparison operator.Easy2Hash mapImplementation+1No attempts yet1s128 MBJudgeable
Hard to Believe, but True!Read the numbers in each equation backwards, add them, and check whether the sum equals the backwards-read result.Easy2StringMath+1No attempts yet1s128 MBJudgeable
Next in LineGiven the ages of the youngest and middle of three children in an arithmetic sequence, print the oldest child's age.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Speed fines are not fine!Given a speed limit and a recorded speed, decide whether the car is speeding and print the matching fine from a three-tier table.Easy2ImplementationMath+2No attempts yet2s512 MBJudgeable
Big Bang SecretsDecode an uppercase word by shifting each letter backward by S = 3P + K positions, where P is the letter's 1-based position.Easy2ImplementationString+1No attempts yet2s512 MBJudgeable
Sumac SequencesStarting from two integers, repeatedly replace the pair with (second, first minus second) until the difference turns negative and report how many terms appear.Easy2SimulationMathNo attempts yet2s512 MBJudgeable
UnfriendCount the subsets of nodes in a rooted tree that can be removed, where removing a node forces removal of all its descendants.Easy2TreeBrute force+1No attempts yet2s512 MBJudgeable
What is n, Daddy?Count the ordered pairs (a, b) with 1 <= b <= a <= 5 and possibly a single hand, summing to n.Easy2MathBrute force+2No attempts yet2s512 MBJudgeable
ISBN 1-3-SumGiven the last three digits of an ISBN starting with 9780921418, compute the 1-3-sum and print it.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Good TimesGiven the time in Ottawa as hour*100+minute, print the local time in seven Canadian cities using fixed offsets, wrapping across midnight.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Body Mass IndexRead a weight and a height, compute weight divided by height squared, and print the BMI category.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Deal or No Deal CalculatorRead eliminated case numbers and a Banker's offer, compute the average of the remaining amounts, and print deal if the offer is higher, otherwise no deal.Easy2ImplementationArray+1No attempts yet1s128 MBJudgeable
Federal Voting AgeFor each birth date, decide whether the person is at least 18 years old on February 27, 2007.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
The Cell SellGiven daytime, evening, and weekend minutes, compute the monthly cost under two phone plans and print the cheaper one.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Mouse MoveThe cursor starts at (0,0) on a screen of width c and height r; each relative move is clamped to the screen edges, and the position after every move must be printed.Easy2SimulationImplementation+2No attempts yet1s128 MBJudgeable
SquaresGiven a number of tiles, find the largest integer side length whose square does not exceed that number.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Terms of OfficePrint every year from X to Y in which all four offices change, which happens on multiples of lcm(4,2,3,5) = 60, formatted as a fixed sentence.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Constrained PermutationsCount permutations of 1..n (n at most 9) that satisfy given ordering constraints x before y.Easy2Brute forceCombinatorics+2No attempts yet1s128 MBJudgeable
Fraction ActionReduce a numerator and denominator to simplest form, then print it as a whole number, a proper fraction, or a mixed number.Easy2MathNumber theory+1No attempts yet1s128 MBJudgeable
Mod InverseGiven x and m, find n with 0 < n < m such that x*n mod m equals 1, or report that none exists.Easy2Number theoryBrute forceNo attempts yet1s128 MBJudgeable
CalendarGiven the weekday of the 1st and the number of days, print a month calendar in a fixed weekly layout with right-aligned columns.Easy2ImplementationSimulation+1No attempts yet1s128 MBJudgeable
Cross-Number PuzzlePrint all perfect numbers from 1000 to 9999, then all three-digit numbers equal to the sum of their digits' cubes.Easy2Brute forceMath+1No attempts yet1s128 MBJudgeable
NumbersGiven three distinct digits and one of their six permutations, find that number's 1-based rank when all six permutations are sorted ascending.Easy2MathSorting+2No attempts yet1s1024 MBJudgeable
Building BlocksGiven a target height N and three block heights, pick the kind whose multiples get closest to N, breaking ties by smaller block then shorter tower.Easy2MathBrute forceNo attempts yet1s1024 MBJudgeable
EntropyRead one line of text, count how often each character appears, and print the Shannon entropy rounded to three decimals.Easy2Hash mapMath+2No attempts yet1s128 MBJudgeable
ExpressionGiven N, build a fully parenthesized NAND (Sheffer stroke) expression for the carry-out bit by iterating a fixed string concatenation rule.Easy2StringImplementation+2No attempts yet1s128 MBJudgeable
Right Triangle CheckFor each of n triples of side lengths, decide whether the triangle is right by checking if the largest side squared equals the sum of the other two squared.Easy2MathGeometry+2No attempts yet1s128 MBJudgeable
GaussFor each test case, compute the sum of all integers from n to m inclusive and print the test case number followed by the sum.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
StuPIdGiven an ID with one unknown digit, use the checksum rule to find the missing digit and print the corrected ID.Easy2MathImplementation+1No attempts yet3s128 MBJudgeable
Sexagenary Cycle (干支)Given a year, print its sexagenary cycle name as a branch letter A-L followed by a stem digit 0-9.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
CuboidsFor each cuboid row with one of the four values zeroed out, compute and print the missing length, width, height, or volume.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
DivisibilityGiven a base-62 string, decide whether the number it represents is divisible by 61.Easy2MathNumber theory+1No attempts yet1s128 MBJudgeable
TeleprimeGiven a six-digit number and a digit to prepend, print Yes if both the original and the resulting seven-digit number are prime.Easy2Number theoryMath+2No attempts yet1s128 MBJudgeable
ConcertRead 10 RGB triples per data set, average each channel, and print the average rounded to the nearest integer.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Ways to Make RectanglesCount the number of unordered pairs (a, b) with a <= b and a*b <= n.Easy2MathBrute force+1No attempts yet1s256 MBJudgeable
PolynomialGiven a polynomial's coefficients and an integer x, print the last three digits of |W(x)|, padded with leading zeros.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
KamilGiven a word Kamil spoke, count the words he could have meant, since each position may map to one of several letters.Easy2MathCombinatorics+1No attempts yet1s128 MBJudgeable
JulkaGiven the total apples and how many more Klaudia has, compute each girl's count.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Units Digit of a Power of TwoThe task is to print the units digit of 2 to the power n for a huge n.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Caesar CipherDecode a Caesar-shifted uppercase message by matching its most frequent letter to the given original letter.Easy2StringArray+1No attempts yet1s512 MBJudgeable
Non-DivisorsGiven n, print the smallest and the largest integers from 1 to n that do not divide n.Easy2Number theoryMathNo attempts yet1s128 MBJudgeable
Sums and DifferencesCount ordered pairs from distinct positions where the difference exceeds the sum, which holds exactly when the second element is negative.Easy2MathCombinatoricsNo attempts yet1s128 MBJudgeable
Step on the FootKozik and Adrian alternately shorten the gap by their foot lengths, and the first player facing a gap shorter than his foot wins.Easy2MathNo attempts yet1s128 MBJudgeable
KwadratDecide whether four given points are the vertices of a non-degenerate square with sides parallel to the axes.Easy2GeometryImplementationNo attempts yet1s128 MBJudgeable