Curated sets

Math and counting

Number theory, combinatorics, and geometry.

All problems
Total results6,670 problems
TopicsJudge
A debugging life that starts with std::sortPrint N = 2 and the two points (1, 0) and (0, 1), a fixed counterexample for a broken comparator in std::sort.Easy1ImplementationSorting+2No attempts yet2s512 MBJudgeable
The Merchant of VeniceSum the cargo values of all ships whose distance is at most s*d, the distance they can cover by the due date.Easy1ImplementationMathNo attempts yet2s512 MBJudgeable
Grass Seed Inc.Given the cost per square metre and a list of rectangular lawns, print the total cost of seeding all of them, rounded to seven decimals.Easy1MathImplementationNo attempts yet2s512 MBJudgeable
Equality CheckRead a quiz line formatted as 'a + b = c' and print YES if a + b equals c, otherwise NO.Easy1ImplementationMathNo attempts yet1s512 MBJudgeable
TunaFor each tuna, take the larger of two estimates when they differ by at most X, otherwise take a third estimate, and print the sum.Easy1ImplementationMathNo attempts yet1s64 MBJudgeable
Two Chickens (...)Given two account balances and the price of one chicken, print the leftover total if two chickens can be afforded, otherwise the current total.Easy1ImplementationMath+1No attempts yet2s512 MBJudgeable
The Y Bus Goes VroomSimulate the passenger count as a bus travels N stops with given boarding and alighting numbers, then print the driver's fixed name.Easy1SimulationImplementation+1No attempts yet2s256 MBJudgeable
Pick the QuadrantRead the x and y coordinates of a nonzero point and print which of the four quadrants it lies in.Easy1ImplementationMathNo attempts yet1s512 MBJudgeable
Shifty SumGiven N and k, print N + 10N + ... + 10^k N.Easy1MathImplementationNo attempts yet1s512 MBJudgeable
Polynomial Derivative (Small)Given the nonzero terms of a polynomial, compute the value of its derivative at x = 1.Easy1MathImplementation+1No attempts yet1s128 MBJudgeable
FizzBuzzPrint the numbers 1 through N, writing Fizz for multiples of X, Buzz for multiples of Y, and FizzBuzz for multiples of both.Easy1ImplementationMath+2No attempts yet1s512 MBJudgeable
AdditionRead two integers between -100,000 and 100,000 and print their sum.Easy1MathImplementationNo attempts yet1s512 MBJudgeable
Judging MooseGiven the tine counts on each side, print the moose's score as Even x, Odd x, or Not a moose when both sides are zero.Easy1ImplementationMathNo attempts yet1s512 MBJudgeable
Hard choiceGiven prepared and requested counts for chicken, beef, and pasta, count passengers whose requested meal is unavailable.Easy1MathImplementationNo attempts yet1s1024 MBJudgeable
Every Second CountsGiven a start and end clock time, compute how many seconds elapsed, adding 24 hours if the ride crosses midnight.Easy1MathImplementationNo attempts yet2s512 MBJudgeable
AnglesFor each triple of angles, print the numbers and say whether they sum to 180.Easy1ImplementationMathNo attempts yet2s512 MBJudgeable
Chanukah CandlesEach evening needs one more candle than the last plus one shammas, so for N days compute N(N+1)/2 + N.Easy1MathImplementationNo attempts yet2s512 MBJudgeable
Sim CardFor each student, compute the smallest total cost of call minutes and data across the three fixed operator price plans.Easy1ImplementationBrute force+1No attempts yet2s512 MBJudgeable
Vera's FashionGiven N tops and N bottoms colored 1 to N, count how many top and bottom pairs have different colors.Easy1MathCombinatorics+1No attempts yet2s256 MBJudgeable
Fast A+BRead T pairs of integers from fast input and print each sum on its own line.Easy1ImplementationMath+1No attempts yet1s512 MBJudgeable
Sum of N integersRead N integers and print their sum, which needs a 64-bit integer type.Easy1ImplementationMathNo attempts yet0.1s512 MBJudgeable
The group project starts and the team leader is goneGiven a distance L, Sungwoo covers 1 to 5 per minute; print the smallest integer number of minutes needed to reach Mingeon.Easy1MathImplementation+1No attempts yet1s128 MBJudgeable
Helmet and VestGiven a list of helmet defense values and a list of vest values, print the sum of the best helmet and the best vest.Easy1ArrayImplementation+2No attempts yet1s512 MBJudgeable
Hansu NumbersCount integers from 1 to N (N up to 1000) whose digits form an arithmetic sequence.Easy2ImplementationBrute force+1No attempts yet2s128 MBJudgeable
Make It DivisibleFind the smallest two-digit replacement (00-99) for the last two digits of N that makes N divisible by F.Easy2Brute forceMath+1No attempts yet2s128 MBJudgeable
Octal to BinaryConvert a huge octal number (up to 333,334 digits) into its binary representation without leading zeros.Easy2StringImplementation+1No attempts yet1s256 MBJudgeable
Sign of Integer SumsFor three separate lists of integers, compute each sum and print whether it is positive, negative, or zero, handling values up to 64-bit signed range.Easy2ImplementationMathNo attempts yet2s256 MBJudgeable
Mobile Phone BillGiven up to 20 call durations, compute total cost under two per-block billing plans and print the cheaper one with its cost.Easy2SimulationImplementation+1No attempts yet2s128 MBJudgeable
House Number SignCompute the total width of a house-number sign given fixed per-digit widths and 1 cm margins between digits and at both ends, for each input number until 0 appears.Easy2ImplementationString+1No attempts yet1s128 MBJudgeable
Easy Sequence SumGiven a sequence where each integer k repeats k times, compute the sum of terms between positions A and B.Easy2MathSimulation+1No attempts yet2s128 MBJudgeable
TV SizeGiven a TV's diagonal length and height-to-width ratio, compute the actual height and width, flooring non-integer results.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Year Progress BarGiven a date and time string, compute what percentage of the current year (accounting for leap years) has elapsed.Easy2ImplementationMathNo attempts yet2s128 MBJudgeable
Actual Disk SpaceGiven N file sizes and a cluster size, compute total disk space used by rounding each file up to the nearest cluster multiple and summing.Easy2MathImplementation+1No attempts yet2s128 MBJudgeable
Reversed AdditionReverse the digits of two numbers up to 1000, add the reversed values, then reverse the sum and print the result.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
24-Hour MissionGiven the current time and a start time in HH:MM:SS, compute the time remaining until the start time next occurs within a 24-hour cycle.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Time MachineGiven three two-digit numbers from a digital clock, count how many of the 6 permutations form a valid HH:MM:SS time.Easy2CombinatoricsBrute force+1No attempts yet2s128 MBJudgeable
Room NumberGiven a room number, count how many plastic digit sets (0-9 each) are needed, treating 6 and 9 as interchangeable when flipped.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Adjusted AverageGiven N exam scores, rescale each by dividing by the maximum score and multiplying by 100, then output the average of the rescaled scores.Easy2ArrayMath+1No attempts yet2s128 MBJudgeable
Manhattan Distance on a Four-Row Number BoardGiven two numbers placed column by column in a 4-row grid, compute the Manhattan distance between their cell positions.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Chicken CouponsGiven n chicken coupons and a stamp-to-coupon exchange rate k, compute the maximum chickens obtainable by repeatedly redeeming stamps for new coupons.Easy2MathSimulation+1No attempts yet2s128 MBJudgeable
Growth PointsSimulate a tree that multiplies its leaves by a yearly factor then subtracts pruned branches, and report the final leaf count.Easy2SimulationMathNo attempts yet1s128 MBJudgeable
Break-Even PointGiven fixed cost A, variable cost B, and price C, find the smallest number of laptops where revenue exceeds total cost, or -1 if impossible.Easy2MathImplementationNo attempts yet0.35s128 MBJudgeable
Next Term in a SequenceGiven a sequence that is either arithmetic or geometric, determine which type it is and output its next term.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Fraction SumAdd two given fractions and output the sum reduced to lowest terms using GCD.Easy2MathNumber theory+1No attempts yet2s128 MBJudgeable
Concatenating Numbers 1Compute the total digit count when integers from 1 to N are written consecutively without spaces.Easy2MathImplementationNo attempts yet0.15s128 MBJudgeable
Numbers With Equal Remainder and QuotientGiven N, find the sum of all positive integers x whose quotient and remainder are equal when divided by N.Easy2MathNo attempts yet2s256 MBJudgeable
Octopus NumbersConvert base-8 strings using nine special symbols (including one for digit -1) into their decimal integer values until a terminator line appears.Easy2StringMath+1No attempts yet1s128 MBJudgeable
Good License PlatesFor each license plate, compute a base-26 value from the three letters and compare it to the four-digit number, printing whether their difference is within 100.Easy2StringImplementation+1No attempts yet1s128 MBJudgeable
Fourth PointGiven two adjacent sides of a parallelogram as endpoint coordinates, compute and print the fourth vertex for each line of input.Easy2GeometryMath+1No attempts yet2s128 MBJudgeable
Year 2007Given a month and day in 2007, compute and print the corresponding day of the week starting from Monday, Jan 1.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Least Common MultipleFor each of up to 1000 pairs of numbers, compute and print the least common multiple.Easy2MathNumber theoryNo attempts yet1s128 MBJudgeable
Counting Pentagon PointsCompute the total pentagonal points after N steps using a simple arithmetic formula, modulo 45678.Easy2MathImplementationNo attempts yet2s256 MBJudgeable
Perfect SquaresGiven two numbers M and N up to 10000, sum all perfect squares in that inclusive range and print the smallest one, or -1 if none exist.Easy2MathBrute force+1No attempts yet2s128 MBJudgeable
Counting PrimesCount how many of up to 100 given numbers (each at most 1000) are prime.Easy2MathBrute forceNo attempts yet2s128 MBJudgeable
PlugsGiven N power strips each with a plug capacity, compute the max number of computers powered when strips are chained from one wall outlet.Easy2MathGreedy+1No attempts yet2s256 MBJudgeable
Self-Replicating NumberCheck whether squaring an integer N reproduces N as the trailing digits of N squared.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Day of the YearGiven day, month, year, compute the day's ordinal number within that year accounting for leap years, until a 0 0 0 terminator.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
Number GameRepeatedly sum decimal digits of each number until one digit remains, processing lines until a terminating zero.Easy2MathImplementationNo attempts yet2s128 MBJudgeable
Prime WordSum letter values (a-z=1-26, A-Z=27-52) for a word and print whether the sum is prime (with 1 counted as prime).Easy2StringMath+1No attempts yet2s128 MBJudgeable
Restoring NumbersFor each given integer up to 100,000, output its prime factorization as prime-exponent pairs in increasing order.Easy2MathNumber theory+1No attempts yet2s128 MBJudgeable
Sum of Consecutive IntegersGiven two integers, print the sum of all integers in the closed range between them, handling either order.Easy2MathImplementationNo attempts yet0.25s128 MBJudgeable
Find the K-th DivisorGiven N and K, find and print the K-th smallest divisor of N, or 0 if it doesn't exist.Easy2MathBrute forceNo attempts yet1s128 MBJudgeable
AI Oven ClockGiven a start time in hours, minutes, seconds and a duration in seconds, compute the finishing time on a 24-hour clock that wraps around.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Candy Teacher Go ChangyoungCheck whether the total number of candies among N students can be evenly divided among them (sum divisible by N).Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Digit Counts in a ProductGiven three 3-digit natural numbers, compute their product and count how many times each digit 0 to 9 appears in it.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Greatest Common Divisor and Least Common MultipleGiven two natural numbers up to 10000, output their greatest common divisor and least common multiple.Easy2MathNumber theoryNo attempts yet1s128 MBJudgeable
U.S. Unit ConversionConvert given values between kilograms/pounds and liters/gallons using fixed conversion factors, rounding to four decimal places.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
Laundry Owner DonghyukGiven a number of cents, output the minimum count of quarters, dimes, nickels, and pennies using a greedy coin breakdown.Easy2GreedyMath+1No attempts yet1s128 MBJudgeable
Weighted Triangular SumCompute a weighted sum of triangular numbers W(n) for up to 300 test cases using a direct formula or loop.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Binary AdditionAdd two binary strings up to length 80 for multiple test cases and print the sum without leading zeros.Easy2StringSimulation+1No attempts yet1s128 MBJudgeable
Base ConversionConvert a number given in an arbitrary base (2 to 36, using letters for digits above 9) into its decimal value.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Fibonacci Number 2Compute the nth Fibonacci number for n up to 90.Easy2Dynamic programmingMathNo attempts yet1s128 MBJudgeable
What Is This Semester's GPA?Compute a weighted GPA from a list of courses, credits, and letter grades, rounded to two decimal places.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
Triangular Gimbap Price ComparisonGiven several price rates for gimbap, compute the cheapest cost to buy exactly 1000 grams using the best per-gram rate among all stores.Easy2MathGreedy+1No attempts yet1s128 MBJudgeable
Sugar DeliveryFind the minimum number of 3kg and 5kg bags that sum to exactly N kilograms, or -1 if impossible.Easy2GreedyMathNo attempts yet1s128 MBJudgeable
Climbing SnailCompute the number of days for a snail climbing A meters by day and sliding B meters by night to reach a pole of height V.Easy2MathSimulationNo attempts yet0.25s128 MBJudgeable
CopyrightGiven A songs and a rounded-up average I, find the smallest total copyrighted melodies consistent with ceil(total/A) = I.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
DominoesGiven N, compute the total dot count across all unique dominoes with halves ranging from 0 to N.Easy2MathCombinatoricsNo attempts yet1s128 MBJudgeable
Year 2009Given a day and month in the year 2009, output the English name of the weekday for that date.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Chessboard PiecesGiven N straight guillotine cuts through a rectangular board, compute the maximum number of resulting pieces.Easy2MathGreedyNo attempts yet1s128 MBJudgeable
Fourth PointGiven three corners of an axis-aligned rectangle, compute the coordinates of the missing fourth corner.Easy2GeometryMath+1No attempts yet1s128 MBJudgeable
Time Until the WarningGiven current time and a future warning time in a day, compute the wait time as a difference modulo 24 hours, printing 24:00:00 if they match.Easy2MathImplementationNo attempts yet1s128 MBJudgeable
Angry ChangyoungFor each match length, decide if it fits diagonally inside a W by H rectangle and print DA or NE accordingly.Easy2GeometryMath+1No attempts yet1s128 MBJudgeable
15-Puzzle DisplacementCompute the total Manhattan distance of each labeled tile from its position in the solved 4x4 15-puzzle board.Easy2ArrayMath+1No attempts yet1s128 MBJudgeable
Number ReversalFor each number, reverse its digits, add to the original, and print YES if the sum is a palindrome, else NO.Easy2StringMath+1No attempts yet1s128 MBJudgeable
Hyunwoo the ProfessorFor each given N, output the number of trailing zeros in N! by counting factors of 5.Easy2MathNo attempts yet1s128 MBJudgeable
Automated Telephone ExchangeGiven a 3-digit exchange index n, count pairs of two-digit numbers a,b (00-99) such that n - a - b = 0.Easy2Brute forceMathNo attempts yet1s128 MBJudgeable
FlatGiven room areas and types, compute total area, total bedroom area, and flat cost using half-weighted balcony area.Easy2ImplementationMathNo attempts yet3s256 MBJudgeable
K-Graph OddityCompute the maximum vertex degree in a graph and output the smallest odd integer greater than or equal to it.Easy2GraphImplementation+1No attempts yet1s128 MBJudgeable
Cutting a BlockGiven a box and n, print the coordinates of n equal slabs formed by evenly spaced cuts along the x-axis, each rounded to 8 decimals.Easy2MathSimulation+1No attempts yet2s64 MBJudgeable
Right TriangleRead triples of side lengths until 0 0 0, and print right if the squares of the two shorter sides sum to the square of the longest, else wrong.Easy2MathImplementation+2No attempts yet1s128 MBJudgeable
LogoTrack a turtle's position and heading through forward, backward, left, and right commands, then report the rounded distance from the start.Easy2SimulationGeometry+2No attempts yet1s128 MBJudgeable
AFC WimbledonGiven the sum and difference of two non-negative scores, print the larger score first, or -1 if no such scores exist.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Combination LockGiven the dial position and three combination numbers, sum the degrees turned clockwise and counter-clockwise to open the lock.Easy2SimulationMath+1No attempts yet1s128 MBJudgeable
Above AverageFor each class, compute the average score and print the percentage of students scoring strictly above it, rounded to three decimals.Easy2MathImplementationNo attempts yet1s256 MBJudgeable
Time ZonesGiven a time and two time zone abbreviations, compute the equivalent wall-clock time in the second zone.Easy2ImplementationMath+1No attempts yet1s128 MBJudgeable
Dog & GopherGiven the gopher's position, the dog's position, and a list of holes, find the first hole the gopher reaches no later than the dog.Easy2ImplementationGeometryNo attempts yet1s128 MBJudgeable
War for Middle-earthFor each battle, compute the weighted score of both armies from six and seven race counts and report the winner or a tie.Easy2ImplementationMathNo attempts yet1s128 MBJudgeable
Tetrahedral Stacks of CannonballsFor each of n queries, read the base side length and print the problem number, the side length, and the total cannonballs in a tetrahedral stack of that size.Easy2MathImplementation+1No attempts yet1s128 MBJudgeable
Bubble Gum, Bubble Gum, in the Dish, How Many Pieces Do You Wish?Given a list of names arranged in a circle, a starting person, and a count n, find who is at position n in the count.Easy2ArraySimulation+1No attempts yet1s128 MBJudgeable