传送门:Fire Game

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

Description

Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they choose two grids which are consisting of grass and set fire. As we all know, the fire can spread among the grass. If the grid (x, y) is firing at time t, the grid which is adjacent to this grid will fire at time t+1 which refers to the grid (x+1, y), (x-1, y), (x, y+1), (x, y-1). This process ends when no new grid get fire. If then all the grid which are consisting of grass is get fired, Fat brother and Maze will stand in the middle of the grid and playing a MORE special (hentai) game. (Maybe it’s the OOXX game which decrypted in the last problem, who knows.)

阅读全文 »

传送门:Pots

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

Description

You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:

  1. FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;
  2. DROP(i) empty the pot i to the drain;
  3. POUR(i,j) pour from pot i to pot j; after this operation either the pot j is full (and there may be some water left in the pot i), or the pot i is empty (and all its contents have been moved to the pot j).

Write a program to find the shortest possible sequence of these operations that will yield exactly C liters of water in one of the pots.

阅读全文 »

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

看了一眼,水题, 不想写了, 感觉提高不大。

传送门:Prime Path

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

Description

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.

阅读全文 »

传送门:Find the Multiple

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

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.

阅读全文 »

传送门:Fliptile

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

Description

Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15) of square tiles, each of which is colored black on one side and white on the other side.

阅读全文 »

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

传送门:POJ 3278 Catch That Cow

Problem

Description

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes of transportation: walking and teleporting.

阅读全文 »

今天突发奇想,想知道 lower_bound()upper_bound() 函数在从大到小的数组中怎么使用,猜想 C++ 中应该会有重载, 果不其然, 正确打开姿势是酱紫。

1
lower_bound(begin, end, val, greater<T>())

发现了一个好玩的东东

传送门:Dungeon Master

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想 ——kuangbin

Problem

Description

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and the maze is surrounded by solid rock on all sides.
Is an escape possible? If yes, how long will it take?

阅读全文 »
0%