Curated sets

Math and counting

Number theory, combinatorics, and geometry.

All problems
Total results6,670 problems
TopicsJudge
Base ConversionConvert the given number written in base A into base B and print its digits separated by spaces.Easy2MathImplementationNo attempts yet2s256 MBJudgeable
Stand on ZanzibarThe program adds yearly increases beyond twice the previous count to bound the number of imported turtles.Easy2MathImplementationNo attempts yet1s256 MBJudgeable
Scaling RecipesScale each recipe from the main ingredient weight and baker percentages, then print every scaled weight rounded half up to one decimal.Easy2ImplementationMathNo attempts yet3s256 MBJudgeable
Dice CupFind the most likely sums of an N-sided and an M-sided die, printing every tied sum from lowest to highest.Easy2Brute forceMathNo attempts yet1s256 MBJudgeable
Turn Direction of Three PointsGiven three points in order, print 1, -1, or 0 depending on whether the path turns left, turns right, or runs straight.Easy2GeometryNo attempts yet1s256 MBJudgeable
Bottled-Up FeelingsFind counts of two bottle sizes that sum exactly to the shipment volume with the fewest bottles, or report Impossible.Easy2Brute forceMathNo attempts yet1s256 MBJudgeable
Lost ExponentsSplit each integer into a base from all but the last digit and an exponent from the last digit, then print the sum of the powers.Easy2MathImplementationNo attempts yet1s64 MBJudgeable
Donation PackagingTrack the stock of three relief sets day by day, ship every packable trio once at least 30 are ready, and print the shipped count or NO.Easy2SimulationMathNo attempts yet1s256 MBJudgeable
Octal, Decimal, HexadecimalConvert one integer given in octal, decimal, or hexadecimal notation to its decimal value.Easy2ImplementationMathNo attempts yet1s256 MBJudgeable
Promotion CountingFrom the before and after head counts in the four divisions, recover the number promoted across each of the three boundaries.Easy2MathNo attempts yet2s512 MBJudgeable
Lazy Spelling Bee (Large)Count distinct words formed by picking each letter from its neighbors in the target word, modulo 1e9+7.Easy2CombinatoricsString+1No attempts yet5s512 MBJudgeable
gWheels (Small)Decide if any pedal gear, two distinct extra gears, and tire gear combine to each target ratio P/Q.Easy2Brute forceMathNo attempts yet5s512 MBJudgeable
Hangul Initial ConsonantsPrint the initial consonant of each Hangul syllable in the given string in order.Easy2MathString+1No attempts yet1s512 MBJudgeable
Dreary Design (Small)Count RGB triples with each component in 0 to K whose largest and smallest values differ by at most V.Easy2Brute forceMathNo attempts yet5s512 MBJudgeable
Fair and Square (Small)Count numbers in each interval [A, B] that are palindromes and squares of palindromes.Easy2Brute forceMath+1No attempts yet5s512 MBJudgeable
Hedgemony (Small)Simulate a single left-to-right pass that trims each bush to the average of its current neighbors and output the final height of bush N-1.Easy2SimulationMathNo attempts yet5s512 MBJudgeable
Dr. Spaceman's height algorithmCompute a child height range from both parents' heights and the child sex, then round both ends inward to whole inches.Easy2ImplementationMathNo attempts yet5s512 MBJudgeable
Quake Live (Small2)Split the given players into two equal teams so the two skill totals differ as little as possible.Easy2Brute forceCombinatoricsNo attempts yet5s512 MBJudgeable
Immigrate to the CTP principalityConvert each item between uppercase letters and their alphabet positions (A=1 to Z=26), in the direction given by the mode character.Easy2ImplementationString+2No attempts yet1s128 MBJudgeable
Tojaengi's Walk to SchoolCount monotone lattice paths from (1,1) to (w,h) that pass through a given shop, modulo 1000007.Easy2CombinatoricsMathNo attempts yet1s128 MBJudgeable
Mini Fantasy WarFor each character, add gear changes to the four base stats, clamp HP and MP to at least 1 and attack to at least 0, then print the weighted combat power.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
XORXORXORXOR the value B into A exactly C times and print the result.Easy2Bit manipulationMathNo attempts yet0.2s512 MBJudgeable
Changyong's ClockTrack a clock's time on a 24-hour dial, turning it forward or backward by c seconds and answering queries for the current time.Easy2SimulationMath+1No attempts yet1s512 MBJudgeable
LobbyGiven the seat counts of two parties, find how many independents must vote yes for a strict majority.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Three SumsFor each N, print the sum of the first N positive integers, the first N odd numbers, and the first N even numbers.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
FormulaGiven triangle vertex coordinates and a measured incircle radius, compute the radius from the formula and print the percentage difference.Easy2GeometryMath+1No attempts yet2s512 MBJudgeable
Manhattan TaxiGiven your waiting intersection and up to 100 taxi positions on a 100x100 grid, print the coordinates of the taxi with the smallest Manhattan distance.Easy2ImplementationBrute force+2No attempts yet2s512 MBJudgeable
MatchesFor each match length, decide whether it fits in a W by H box, meaning its length is at most the diagonal sqrt(W^2+H^2).Easy2GeometryMath+1No attempts yet2s512 MBJudgeable
Divisor CountFor each of up to 10 values of n below 10000, print n and its divisor count.Easy2Number theoryBrute forceNo attempts yet2s512 MBJudgeable
The real Manhattan distanceGiven two points (x, y, floor), compute the walking distance: down from each floor, plus Manhattan street distance.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Collatz SequenceStarting from n, repeatedly apply the Collatz rule (halve evens, 3n+1 for odds) and print every value from n down to 1 on one line.Easy2SimulationImplementation+1No attempts yet2s512 MBJudgeable
ChessboardPrint an N by M grid of asterisks and dots where the top left cell is an asterisk and adjacent cells always differ.Easy2ArrayImplementation+2No attempts yet2s512 MBJudgeable
Least Common MultipleGiven two integers below 100,000,000, print their least common multiple, which can exceed the 32-bit range.Easy2MathNumber theory+1No attempts yet2s512 MBJudgeable
Quick EstimatesRead N integers up to 10^100 and print the number of digits in each, counting 0 as one digit.Easy2StringMath+1No attempts yet2s512 MBJudgeable
Room AssignmentCount boys and girls per grade and sum the ceiling of each count divided by the room capacity K.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Jumbled CompassGiven two compass directions from 0 to 359, print the signed rotation with the smallest magnitude that moves the needle from the first direction to the second, breaking ties toward clockwise.Easy2MathImplementation+1No attempts yet2s512 MBJudgeable
Math ContestGiven a huge decimal integer x, print YES if x is divisible by 9 and NO otherwise.Easy2Number theoryMath+1No attempts yet1s512 MBJudgeable
Four Arithmetic OperationsEach line gives an expression a op b = c with single-digit spacing, and you print correct or wrong answer depending on whether the arithmetic matches the claimed result.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
Anniversary CakeGiven a rectangle and two interior candles, output the specific cut described by a fixed rule that separates the candles.Easy2GeometryImplementation+1No attempts yet2s256 MBJudgeable
Data PlanTrack monthly data allowance that rolls over, subtract each month's usage, and report the megabytes available in month N+1.Easy2ImplementationMathNo attempts yet1s64 MBJudgeable
Cleaning StationsGiven weights and a feature matrix, print the indices of the rows whose weighted sum is largest, in ascending order, for each of K data sets.Easy2ImplementationArray+1No attempts yet2s512 MBJudgeable
Walking in timeGiven three credit values, decide whether choosing some of them with signs (+ or -) sums to zero using at least one credit.Easy2Brute forceMath+1No attempts yet1s512 MBJudgeable
Alarm ClockFor each case, compute how many minutes pass from the current time until the alarm time, rolling over to the next day when needed.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Dividing NlogôniaGiven a divider point, classify each house coordinate into one of four quadrants or as lying on a dividing line.Easy2ImplementationMathNo attempts yet2s512 MBJudgeable
Pokemon GOFor each species, compute how many net 10-candy evolutions are possible, sum them, and find the species with the most evolutions.Easy2MathImplementationNo attempts yet1s32 MBJudgeable
Olympic GamesFor each year, decide whether it is a summer Olympic year, and if so whether the games were held, cancelled by a war, or not yet assigned a city.Easy2ImplementationMathNo attempts yet2s512 MBJudgeable
Splitting into Two TeamsGiven four sorted skill levels, split them into two pairs of two and print the smallest possible difference between the two pair sums.Easy2Brute forceMath+1No attempts yet2s512 MBJudgeable
Unit ConversionGiven x of unit A equals y of unit B, convert each listed amount to the other unit and print the result to six decimals.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
FuelConvert fuel consumption from miles per gallon to liters per 100 kilometers using the given conversion constants.Easy2MathImplementationNo attempts yet1s512 MBJudgeable
Luhn AlgorithmGiven a sixteen-digit card number as a string, check whether it passes the Luhn checksum and print DA or NE.Easy2StringImplementation+2No attempts yet1s512 MBJudgeable
TelephoneFind the base between 2 and 10 whose representation of N has the fewest adjacent digit changes, breaking ties by the largest base.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Income taxFor each income, subtract 0, 10 percent, or 20 percent tax depending on whether income is at most 1,000,000, at most 5,000,000, or larger.Easy2ImplementationMathNo attempts yet2s512 MBJudgeable
GradesGiven a list of grades, compare the midpoint of the maximum and minimum against the overall average, and report whether they differ by less than 1.Easy2ArrayMath+1No attempts yet2s512 MBJudgeable
Counting Sheep (Large)For each N, find the first multiple of N that contains all ten digits, or report that no such multiple exists (only N = 0).Easy2MathSimulation+1No attempts yet5s512 MBJudgeable
MicrowaveGiven a start temperature below target, compute total heating time using per-degree rates for frozen and unfrozen states plus a fixed thawing time.Easy2MathImplementation+1No attempts yet2s512 MBJudgeable
One Hundred to TenParse a ratio written as n:m, divide both numbers by their greatest common divisor, and print the reduced ratio in the same format.Easy2MathNumber theory+1No attempts yet2s512 MBJudgeable
Base 9Convert a given decimal integer between 1 and 10000 into its base 9 representation.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Fibonacci-like SequenceGiven n up to 116, compute the n-th term of the recurrence f(n) = f(n-1) + f(n-3) with f(1)=f(2)=f(3)=1.Easy2Dynamic programmingMath+1No attempts yet2s512 MBJudgeable
Speed LimitFor each log entry, multiply the speed by the time since the previous entry, sum these products, and print the total distance in miles.Easy2ImplementationMath+1No attempts yet5s512 MBJudgeable
Linear EquationFor each linear equation ax + b = c, decide whether it has no, one, or infinitely many solutions and print the root truncated to six decimals.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Card Game ContestFor each of N games, Meiji has A_i decks, or gets one basic deck if A_i is 0. Count the number of distinct ways to enter, modulo M.Easy2MathImplementation+2No attempts yet1s256 MBJudgeable
Perfect, deficient, or abundantFor each of T numbers below 10000, sum its proper divisors and classify it as Perfect, Deficient, or Abundant.Easy2MathBrute force+1No attempts yet1s128 MBJudgeable
2017 Yonsei University Programming ContestCount triples (A, B, C) with A+B+C = N, all at least 1, C at least B+2, and A even.Easy2Brute forceMath+1No attempts yet1s128 MBJudgeable
EmpathyMultiply two binary numbers up to 30 bits long and print the product in binary without leading zeros.Easy2MathString+2No attempts yet2s256 MBJudgeable
Recovering a Damaged ISBN DigitOne digit of a 13-digit ISBN is replaced by '*', and you print the digit that makes the weighted checksum divisible by 10.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
I am happy~Given the height N, width M, and a seat number K in row-major order, print the row and column of that seat.Easy2MathImplementation+2No attempts yet2s256 MBJudgeable
Credit Card ValidationFor each 16-digit card number, apply the Luhn checksum (double every second digit from the right, sum digits) and print T if the total is divisible by 10, else F.Easy2ImplementationString+1No attempts yet1s128 MBJudgeable
Paint EstimateFor each floor plan, compute the paintable wall and ceiling area minus window and door areas, multiply by the number of apartments, and round the total up by the coverage of one can.Easy2MathImplementation+2No attempts yet2s512 MBJudgeable
Bedtime Reading IGiven an integer I, compute the sum of all its divisors.Easy2MathNumber theory+1No attempts yet2s512 MBJudgeable
Term index in an arithmetic sequenceGiven a first term, a common difference, and a value k, print the 1-based position of k in the arithmetic sequence, or X if k is absent.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Sharing apples and bananasGiven a apples and b bananas, print every common divisor n of a and b with the per-friend apple and banana counts.Easy2MathNumber theory+1No attempts yet2s512 MBJudgeable
Base converterConvert a decimal integer m into base n (2 to 16), using A-F for digits 10 and above.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Building a distribution tableGiven real numbers in [0,1), count how many fall into each of m equal-length subintervals and print the counts in order.Easy2ImplementationArray+1No attempts yet1s512 MBJudgeable
The 3n+1 SequenceStarting from the given first term, apply the 3n+1 rule until the value first hits 1 and report that position.Easy2SimulationMath+1No attempts yet1s512 MBJudgeable
Von Neumann and the FlyGiven train speed S, fly speed T, and initial gap D, compute how far the fly travels before the two trains collide.Easy2MathImplementation+2No attempts yet1s512 MBJudgeable
Soccer SkillsAmong all teammates whose distance from you is between a and b, print the position, distance, and angle of the one with smallest x then smallest y.Easy2ImplementationGeometry+1No attempts yet2s512 MBJudgeable
I Work All DayGiven a list of saw settings and a tree height T, pick the setting H that minimizes T mod H, breaking ties by first appearance.Easy2ImplementationBrute force+1No attempts yet1s512 MBJudgeable
Just A MinimGiven a list of note codes, sum their lengths in semibreves and print the exact value.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Coffee MachineGiven the number of employees on each of three floors, pick the floor for one coffee machine that minimizes total daily stair time.Easy2Brute forceMath+1No attempts yet1s1024 MBJudgeable
Happy TrailsGiven trail sections as angles and distances, compute the total elevation change and print it rounded to two decimals.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Arggggggh!Follow a start point and a series of compass moves to compute the final coordinates, rounded to 8 decimals.Easy2ImplementationMath+1No attempts yet2s512 MBJudgeable
Life SavingsCompare the savings from one 20%-style whole-purchase coupon against the best way to spend two one-item coupons on two of three items, then print the winning plan and its savings.Easy2Brute forceMath+2No attempts yet2s512 MBJudgeable
Batter UpRead n at-bat outcomes, sum the bases from official at-bats (0 to 4), divide by how many of them are not walks, and print the result to six decimals.Easy2ImplementationMath+2No attempts yet2s512 MBJudgeable
Congruent NumbersGiven the two legs of a right triangle as fractions p1/q1 and p2/q2, print 1 if the triangle's area is an integer, otherwise 0.Easy2MathNumber theory+1No attempts yet2s512 MBJudgeable
Boolean SatisfiabilityCount the assignments of a disjunction of single literals that make the formula true, where each variable takes true or false.Easy2CombinatoricsMath+2No attempts yet3s512 MBJudgeable
Incomplete BookGiven the first book takes k days and each later book takes twice the previous, count how many books finish by day d.Easy2MathSimulation+1No attempts yet1s512 MBJudgeable
Beautiful MusicFor each note sequence, check whether every consecutive pair is 2, 4, or 6 steps apart on the repeating 7-note scale, and print one of two messages.Easy2ImplementationString+1No attempts yet2s512 MBJudgeable
Sum Squared Digits FunctionFor each of P datasets, convert the given integer n to base b, square each digit, and report the total with the dataset number.Easy2MathImplementation+1No attempts yet2s512 MBJudgeable
Santa's GiftsCompute the total straight-line distance from Santa's house through four given points in 3D and check it does not exceed the time limit X.Easy2MathGeometry+2No attempts yet5s512 MBJudgeable
Big number A+BRead two integers with up to 10000 digits and print their sum without leading zeros.Easy2StringMath+2No attempts yet1s256 MBJudgeable
A Simple ProblemGiven N, print the smallest positive multiple of N squared, which is just N squared itself.Easy2MathImplementation+1No attempts yet3s512 MBJudgeable
Check the CheckRead dish names and price-quantity pairs until the line TOTAL, then print PAY if the waiter's total is at most the sum of price times quantity, else PROTEST.Easy2ImplementationString+1No attempts yet2s512 MBJudgeable
Shattered CakeGiven the cake's width and the dimensions of all shattered rectangular pieces, sum the piece areas and divide by the width to get the length.Easy2MathImplementation+2No attempts yet10s512 MBJudgeable
Triangles from Five SticksGiven five distinct stick lengths, count how many 3-stick subsets can form a triangle with positive area.Easy2Brute forceGeometry+1No attempts yet2s512 MBJudgeable
Jaccard Similarity ThresholdGiven two small sets of digits, decide whether their Jaccard similarity is greater than 0.5.Easy2ImplementationMathNo attempts yet1s512 MBJudgeable
PencilsChoose either set X or set Y, buy any number of copies of that one set, and pay the least to reach at least N pencils.Easy2MathImplementationNo attempts yet2s512 MBJudgeable
Hash collision stringsPrint two length-N strings that differ but have equal Java String hashCode values, using the classic Aa/BB collision with a shared prefix.Easy2StringHash map+2No attempts yet2s512 MBJudgeable
Abbey CourtyardGiven the area of a square courtyard, compute the perimeter as 4 times the square root of the area, rounded to six decimal places.Easy2MathImplementation+1No attempts yet1s512 MBJudgeable
Cube BitsConvert each of n decimal integers (up to 3^20) to its base-3 representation without leading zeros.Easy2MathImplementationNo attempts yet4s512 MBJudgeable
Sum of DivisorsGiven a natural number n up to 10000, print the sum of all its positive divisors, with 1 and n included.Easy2MathBrute forceNo attempts yet1s256 MBJudgeable