0%

Codeforces 185A - Plant

Plant

Dwarfs have planted a very interesting plant, which is a triangle directed “upwards”. This plant has an amusing feature. After one year a triangle plant directed “upwards” divides into four triangle plants: three of them will point “upwards” and one will point “downwards”. After another year, each triangle plant divides into four triangle plants: three of them will be directed in the same direction as the parent plant, and one of them will be directed in the opposite direction. Then each year the process repeats. The figure below illustrates this process.

閱讀全文 »

Codeforces 707B - Bakery

Bakery

Masha wants to open her own bakery and bake muffins in one of the n cities numbered from 1 to n. There are m bidirectional roads, each of whose connects some pair of cities.

閱讀全文 »

Codeforces 581B - Luxurious Houses

Luxurious Houses

The capital of Berland has n multifloor buildings. The architect who built up the capital was very creative, so all the houses were built in one row.

閱讀全文 »

Codeforces 1141A - Game 23

Game 23

Polycarp plays “Game 23”. Initially he has a number n and his goal is to transform it to m. In one move, he can multiply n by 2 or multiply n by 3. He can perform any number of moves.

閱讀全文 »

Codeforces 599A - Patrick and Shopping

Patrick and Shopping

Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d1 meter long road between his house and the first shop and a d2 meter long road between his house and the second shop. Also, there is a road of length d3 directly connecting these two shops to each other. Help Patrick calculate the minimum distance that he needs to walk in order to go to both shops and return to his house.

閱讀全文 »