2178 - I2P(I)2020_Huang_lab8 Scoreboard

Time

2020/11/19 08:00:00 2020/11/19 11:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12998 Palindrome Detection (hard version)
12999 Minesweeper

12998 - Palindrome Detection (hard version)   

Description

  • A palindrome is a word like “deed” or “level”, which remains the same when you spell it backward.

  • Write a program that inputs a word that terminates with a period '.' and determines whether or not the word is a palindrome.

  • Each input word's length is at least 1 and there is no maximum limit for its length. You must use DYNAMIC ARRAYs to do this task.

  • (Hint: You may define an array of size 20 to take the input first. If it's not enough, double its size to allow more input.)

Input

String of characters that terminates with a period '.'

Output

"a palindrome\n" or "not a palindrome\n"

Sample Input  Download

Sample Output  Download

Tags




Discuss




12999 - Minesweeper   

Description

Write a program to input an H x W array of 0’s and 1’s where H and W are also user inputs.  You may assume that both H and W are non-zero and at most 10.  The array represents an H x W minefield so that a cell with a 1 (resp. 0) means the cell contains (does not contain) a bomb.  Your program should print the minefield as follows:

  1. If a cell contains a bomb, print a ‘#’.
  2. If a cell does not contain a bomb and is not adjacent to any bomb, print a ‘.’

  3. Otherwise, print the number of neighboring bombs.

Input

 

  • The first input, H and W, is the size of the HxW array.

  • Next H lines will be the elements of the array.

Output

Output a HxW array

  • If a cell contains a bomb, print a ‘#’.
  • If a cell does not contain a bomb and is not adjacent to any bomb, print a ‘.’
  • Otherwise, print the number of neighboring bombs.

Sample Input  Download

Sample Output  Download

Tags




Discuss