0%

Codeforces 216B - Teams Forming

Teams Forming

One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.

閱讀全文 »

Codeforces 812A - Sagheer and Crossroads

Sagheer and Crossroads

Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 lanes getting out of the intersection, so we have 4 parts in total. Each part has 4 lights, one for each lane getting into the intersection (l — left, s — straight, r — right) and a light p for a pedestrian crossing.

閱讀全文 »

Codeforces 124A - The number of positions

The number of positions

Petr stands in line of n people, but he doesn’t know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Petr can occupy.

閱讀全文 »

Codeforces 426A - Sereja and Mugs

Sereja and Mugs

Sereja showed an interesting game to his friends. The game goes like that. Initially, there is a table with an empty cup and n water mugs on it. Then all players take turns to move. During a move, a player takes a non-empty mug of water and pours all water from it into the cup. If the cup overfills, then we assume that this player lost.

閱讀全文 »

Codeforces 935A - Fafa and his Company

Fafa and his Company

Fafa owns a company that works on huge projects. There are n employees in Fafa’s company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the employees.

閱讀全文 »

Codeforces 760B - Frodo and pillows

Frodo and pillows

n hobbits are planning to spend the night at Frodo’s house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of course, it’s not always possible to share pillows equally, but any hobbit gets hurt if he has at least two pillows less than some of his neighbors have.

閱讀全文 »

Codeforces 507A - Amr and Music

Amr and Music

Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.

閱讀全文 »

Codeforces 165B - Burning Midnight Oil

Burning Midnight Oil

One day a highly important task was commissioned to Vasya — writing a program in a night. The program consists of n lines of code. Vasya is already exhausted, so he works like that: first he writes v lines of code, drinks a cup of tea, then he writes as much as ⌊v/k⌋ lines, drinks another cup of tea, then he writes ⌊v/k2⌋ lines and so on: ⌊v/k3⌋ , ⌊v/k4⌋ , ⌊v/k5⌋ , …

閱讀全文 »

Codeforces 609A - USB Flash Drives

USB Flash Drives

Sean is trying to save a large file to a USB flash drive. He has n USB flash drives with capacities equal to a1, a2, …, an megabytes. The file size is equal to m megabytes.

閱讀全文 »