0
点赞
收藏
分享

微信扫一扫

寒假学习第三天

以前干嘛去了 2022-01-20 阅读 119
p2plinqc#

刚从外婆家吃饭回来,嗝~~

还是枚举吧,来个简单又好玩的炸弹小游戏,咳咳。。。

                                          Bomb Game

  Bosko and Susko are playing an interesting game on a board made of rectangular fields arranged in A rows and B columns.

When the game starts, Susko puts its virtual pillbox in one field one the board. Then Bosko selects fields on which he will throw his virtual bombs. After each bomb, Susko will tell Bosko whether his pillbox is in the range of this bomb or not.

The range of a bomb with diameter P (P is always odd), which is thrown in field (R, S), is a square area. The center of the square is in the field (R, S), and the side of the square is parallel to the sides of the board and with length P.

After some bombs have been thrown, Bosko should find out the position of Susko's pillbox. However, the position may be not unique, and your job is to help Bosko to calculate the number of possible positions.

输入

First line of input contains three integers: A, B and K, 1 <= A, B, K <=100. A represents the number of rows, B the number of columns and K the number of thrown bombs.

Each of the next K lines contains integers R, S, P and T, describing a bomb thrown in the field at R-th row and S-th column with diameter P, 1 <= R <= A, 1 <= S <= B, 1 <= P <= 99, P is odd. If the pillbox is in the range of this bomb, T equals to 1; otherwise it is 0.

输出

Output the number of possible fields, which Susko's pillbox may stay in.

翻译:

                                                            炸弹游戏

  博斯科和苏斯科正在一个由矩形区域组成的棋盘上玩一个有趣的游戏,这些区域排列成A行和B列。游戏开始时,苏斯科将虚拟碉堡放在棋盘上的一个区域。然后,博斯科选择他将投掷虚拟炸弹的场地。每次炸弹爆炸后,苏斯科都会告诉博斯科他的碉堡是否在这枚炸弹的射程之内。
直径为P(P总是奇数)的炸弹被投掷到场地(R,S)的范围是一个正方形区域。正方形的中心位于区域(R,S)中,正方形的侧面与电路板的侧面平行,长度为P。
在投掷了一些炸弹之后,博斯科应该找到苏斯科碉堡的位置。然而,位置可能不是唯一的,你的工作是帮助博斯科计算可能的位置数量。


输入:
输入的第一行包含三个整数:A、B和K,1<=A、B、K<=100。A表示行数,B表示列数,K表示投掷炸弹的数量。
接下来的K行中的每一行都包含整数R、S、P和T,用于描述在第R行和第S列的字段中投掷的炸弹,直径为P,1<=R<=a,1<=S<=B,1<=P<=99,P为奇数。如果碉堡在这个炸弹的射程内,T等于1;否则为0。


输出:
输出苏斯科的pillbox可能保留的可能字段数。
 

举报

相关推荐

第三天学习

java学习第三天

打卡学习第三天

RHCSA学习第三天

编程学习第三天

【python学习第三天】

JS学习第三天

jQuery学习第三天

0 条评论