Loi_Vampire's Blog

自己选择的路,就算跪着也要走完

12/31
13:46
TEST

Good Bye 2016

2016的最后一天了,凌晨打了CF……做得很差 rating又掉惨了TAT 在这里写一下前三题的做法吧……

A. New Year and Hurry

给定n个问题,按难度拍好了序,解决第i个问题花费的时间为5*i,从20:00开始到24:00,期间还要花费k分钟去另一个地方,问最多能解决多少问题。

Examples

input
3 222

output
2

input
4 190

output
4

input
7 1

output
7

直接for一遍即可。

 

B. New Year and North Pole

一只北极熊从北极出发,共有n次操作:North \South\ East\ West +一段距离

特殊的:

  • 当北极熊在北极或经过北极时,只能往南走
  • 当北极熊在南极或经过南极时,只能往北走
  • 最后,北极熊必须在北极点

n次操作后,满足所有以上条件输出"YES";否则,输出"NO"

Examples

input
5
7500 South
10000 East
3500 North
4444 West
4000 North

output
YES

input
2
15000 South
4000 East

output
NO

input
5
20000 South
1000 North
1000000 West
9000 North
10000 North

output
YES

input
3
20000 South
10 East
20000 North

output
NO

input
2
1000 North
1000 South

output
NO

input
4
50 South
50 North
15000 South
15000 North

output
YES

Note Drawings below show how Limak's journey would look like in first two samples. In the second sample the answer is "NO" because he doesn't end on the North Pole.

也是模拟,注意随时判一下那几个条件即可。

 

C. New Year and Rating

模拟CF赛制,共有n场比赛,每场比赛两个信息,rating变化,以及在哪一组.(rating在1900及以上时div1;1899及以下时div2) 求n场比赛后rating最大可能是多少。

Examples
input
3
-7 1
5 2
8 2

output
1907

input
2
57 1
22 2

output
Impossible

input
1
-5 1

output
Infinity

input
4
27 2
13 1
-50 1
8 2

output
1897

Note In the first sample, the following scenario matches all information Limak remembers and has maximum possible final rating:

Limak has rating 1901 and belongs to the division 1 in the first contest. His rating decreases by 7. With rating 1894 Limak is in the division 2. His rating increases by 5. Limak has rating 1899 and is still in the division 2. In the last contest of the year he gets  + 8 and ends the year with rating 1907. In the second sample, it's impossible that Limak is in the division 1, his rating increases by 57 and after that Limak is in the division 2 in the second contest.

嗯……刚开始听a神犇说是线性规划做,好吧还是我太弱了TAT

二分是可以的

 

剩下的题目就当挖个坑吧……以后再去做