Green Boy Can't You Solve It Out?

2 problems for div3 participants

Bomb Defusing II

Statement

Find how many years in range [l,r] that it has Sept.1 as a weekend(Sunday and Saturday)?

Example

l=2017,r=2019
out=2
2018/9/1 is Saturday while 2019/9/1 is Sunday

Constriants

(Div2A-Div2B)→1,000<=L<=R<=9,999
(Div2B-Div2C)→1,000<=L<=R<=1,000,000,000

Flying Mouse

Statement

You are flying on a 2D plane. Your position is (1,x) where x is given. There are N bouncy platforms. The i-th one is located at (i,h_i) and has bouncy attribute b_i
You can do the following moves when you are at some point (x,y):

  1. parachut to (z,y-1) if |z-x|\leq1

  2. jump to (x,h_i+b_i) if you are on some bouncy platform. ie.you can jump if you have y=h_x

  3. die if you are below some bouncy platform. ie.you will die if y\lt h_x

What's the maximum height you can achieve when you reached x=N+1? Print -1 if you can't reach there.

Example

H={0,0,0}
B={10,0,0}
x=2
Output=7
Start at (1,2) then fly to (2,1) then fly to (1,0) then jump to (1,10) then fly to (2,9) (3,8) (4,7).You can also fly to (2,1) then fly to (3,0) then fly to (4,-1) which is not better.

Constriants

Div2B→All data doesn't exceed 1000.
(Div2B-Div2C)→All data doesn't exceed 1,000,000

Enjoy the problems, green boys 🙂

版权声明:
作者:XGN
链接:https://blog.hellholestudios.top/archives/273
来源:Hell Hole Studios Blog
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>
文章目录
关闭
目 录