注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
. Χ
Roblox OA, 求大米!
题1:.--
There are some lamps placed on a coordinate line. Eachof these lamps illuminates some space around it within agiven radius. You are given the coordinates of the lampson the line, and the effective radius of each of the lampslight.
In other words, you are given a two-dimensional arraylamps , where lamps[i] contains information aboutthe ith lamp.
lamps[i][o] is an integer representing the lamp's coordinate,.google и
lamps[i][1] is a positive integer representing the lamp's effective radius.
That means that the ith lamp illuminates everything in a range from lamps[i][0] lamps[i][l] to lamps[i][0]+ lamps[i][1]inclusive.
Your task is to find the number of integer coordinatesthat are illuminated by exactly 1 lamp.
Example
For lamps =[[-2,3],[2,3],[2,1]] ,the output should be solution(lamps)=6
题2:
Let's define a rhombic area of size r as the set of allcells that are less than r steps away (up, down, left, orright) from a given center cell in a matrix. This numberr is called the radius of the rhombic area.
In the image below, the black cell is the center of therhombic area, and every cell contains a numberrepresenting the distance to the center - the radius. Therhombic area of size r includes all cells with numbers1, 2 ,., r in them.
Cells with the same radius are colored in the same colorThe distance between a center cell (centerx, centerY) and another cell (cellx,celly)iscalculated as follows distance = abs(centerx-cellx)+ abs(centerY-cellY)+1,where abs(x)is an absolute value of x.
For each possible center cell of the matrix , findthe sum of all elements within the surrounding
rhombic area of size radius . Note. only conside!the rhombic areas whose elements all fit within thebounds of the matrix. check 1point3acres for more.
From among these sums, find the highest valueReturn an integer representing the highest sum. ..
Example
matrix=[
[0, 2,4,1,6,4],
[5, 1,3,4,1,5],
[0, 1,2,1,2,1],. ----
[1, 3,2,1,1,2],
[4, 1,3,6,5, 5],. 1point3acres
[6, 7, 5,3, 1,2]]
and radius = 3 . Χ
the output should be 35 |