题意:给一个\(n\)X\(m\)的矩阵,矩阵中某个数字\(k\)表示其四周恰好有\(k\)个不为0的数字,你可以使任意位置上的数字变大,如果操作后满足条件,输出新矩阵,否则输出NO. 题解:贪心,既然能使任意位置加大任意数值,那么我们可以将所有位置都给他填满,这样的话,只要是满足条件的情况就都能这样输出,所以我们遍历每个位置,然后判断周围能填多少个,如果某个数大于周围能填的个数,那么就不满足条件. 代码: int t; int n,m; int a[400][400]; int dx[4]={…
题目链接: C - Grid of Lamps Time Limit:1000MSMemory Limit: 0KB 问题描述 We have a grid of lamps. Some of the lamps are on, while others are off. The luminosity of a row/column is the number of its lighted lamps. You are given a permutation of the luminositie…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
题目链接: 传送门 Lawnmower time limit per test:2 second memory limit per test:256 megabytes Description You have a garden consisting entirely of grass and weeds. Your garden is described by an n × m grid, with rows numbered 1 to n from top to bottom, an…
A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/problem/A Description You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square r…
On or Off Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=93265#problem/C Description Saving electricity is very important! You are in the office represented as R \times C grid that consists of walls…
Description Drazil created a following problem about putting × tiles into an n × m grid: "There is a grid with some cells that are empty and some cells that are occupied. You should use 1 × 2 tiles to cover all empty cells and no two tiles should c…
Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turned into a game player of minecraft. On that day, Clarke set up local network and chose create mode for sharing his achievements with others. Unfortunately…