EppsNet Archive: Competitive Programming

Competitive Programming: CodeSignal – footballGroupStatictics (A World Cup SQL Challenge)

Description You are creating a website that will help you and your friends keep track of the results of soccer games from all around the world. You store all results of one group in a table, results. You want to sort the teams in a complex way – first by points, then by total goal differences, and then by total… Read more →

Competitive Programming: CodeSignal – canScore (A World Cup Challenge)

Description Your friend is a soccer fan and you were watching some World Cup matches with him. You liked this game, but the rules are very complicated for you, so you decided just to try to guess whether the given attack will end with a goal or not. In the beginning, the ball is in the attacking team’s goalkeeper’s hands.… Read more →

Competitive Programming: POJ 3281- Dining

Description Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others. Farmer John has cooked fabulous meals for his cows, but he forgot to check his menu against their preferences. Although he might not be able to stuff everybody, he wants to give a complete meal of both food… Read more →

Competitive Programming: POJ 2455 – Secret Milking Machine

Description Farmer John is constructing a new milking machine and wishes to keep it secret as long as possible. He has hidden in it deep within his farm and needs to be able to get to the machine without being detected. He must make a total of T (1 <= T <= 200) trips to the machine during its construction.… Read more →

Competitive Programming: POJ 2195 – Going Home

Description On a grid map there are n little men and n houses. In each unit time, every little man can move one unit step, either horizontally, or vertically, to an adjacent point. For each little man, you need to pay a $1 travel fee for every step he moves, until he enters a house. The task is complicated with… Read more →

Competitive Programming: POJ 3169 – Layout

Description Like everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are standing in the same order as they are numbered, and since they can be rather pushy, it is possible that two or… Read more →

Competitive Programming: POJ 1125 – Stockbroker Grapevine

Description Stockbrokers are known to overreact to rumors. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumors in the fastest possible way. Unfortunately for you, stockbrokers only trust information coming from their “Trusted sources” This… Read more →

Competitive Programming: POJ 2488 – A Knight’s Journey

Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The world of a knight is the chessboard he is living on. Our knight lives… Read more →

Competitive Programming: POJ 1159 – Palindrome

Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters to be inserted into the string in order to obtain a palindrome. As an example, by inserting 2 characters, the… Read more →

Competitive Programming: POJ 2663 – Tri Tiling

Description In how many ways can you tile a 3xn rectangle with 2×1 dominoes? Here is a sample tiling of a 3×12 rectangle. Input Input consists of several test cases followed by a line containing -1. Each test case is a line containing an integer 0 <= n <= 30. Output For each test case, output one integer number giving… Read more →

Competitive Programming: POJ 1426 – Find The Multiple

Description Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there is a corresponding m containing no more than 100 decimal digits. Input The input file may contain multiple test cases.… Read more →

Competitive Programming: POJ 2084 – Game of Connections

Description This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n – 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one… Read more →

Competitive Programming: USACO Big Barn

Farmer John wants to place a big square barn on his square farm. He hates to cut down trees on his farm and wants to find a location for his barn that enables him to build it only on land that is already clear of trees. For our purposes, his land is divided into N x N parcels. The input… Read more →

Competitive Programming: POJ 1654 – Area

Description Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, …. In a subtree whose root node is X, we can get the minimum number in this subtree by repeating going down the left node until the last level, and we can also find the maximum number by going… Read more →

Competitive Programming: POJ 2242 — The Circumference of the Circle

Description To calculate the circumference of a circle seems to be an easy task – provided you know its diameter. But what if you don’t? You are given the cartesian coordinates of three non-collinear points in the plane. Your job is to calculate the circumference of the unique circle that intersects all three points. Input The input will contain one… Read more →