CF 750C New Year and Rating
来源:互联网 发布:js api demo 编辑:程序博客网 时间:2024/04/28 18:13
好久没有更新博客了。
不过,2017第一更。
Ideas worth spreading
http://codeforces.com/problemset/problem/750/C
Description
首先输入N
然后N行
每次两个数 A B
表示当前比赛的分数变化 和 当前比赛的段位
问最后最高可能是多少分
Alogrithm
假设开始时0分,然后累加
这样就可以得到一个相对的分数和段位
例如
3-7 15 28 2
这组数据,相对的分就是
0 1-7 2-2 26 ?
这组数据的意思是在”相对分”的情况下所处的段位
那么可以知道如果在第二段的”相对分”比第一段大,肯定哪里出问题了
不然就是有解的
我们找到最大的第二段的分,假设是max2,那么max2+1 对应的分为 1900的情况下最终分最大
这样ans = 1900-(max2 + 1) + s
s为最终的相对分
Code
import sysimport mathn = int(sys.stdin.readline())min1 = float('inf')max2 = -min1s = 0x = 0lv = 0for i in range(n): args = sys.stdin.readline().split() lv = int(args[1]) if lv == 1: min1 = min(min1, s) elif lv == 2: max2 = max(max2, s) x = int(args[0]) s += xif min1 <= max2: print("Impossible")else: if math.isinf(max2): print("Infinity") else: print(1900-(max2 + 1) + s)
0 0
- CF 750C New Year and Rating
- 【codeforces 750C】New Year and Rating
- codeforces 750C New Year and Rating
- Codefroces 750C New Year and Rating
- 750C New Year and Rating
- Codeforces 750 C New Year and Rating
- Codeforces 750C New Year And Rating 二分判定
- 【codeforces 750C】New Year and Rating(做法2)
- codeforces 750-C. New Year and Rating(模拟)
- New Year and Rating
- CF Good Bye 2016 C New Year and Rating 模拟乱搞
- GoodBye2016C. New Year and Rating
- New Year and Rating CodeForces
- New Year and Rating CodeForces
- New Year and Rating CodeForces
- codeforces goodbye 2016 C. New Year and Rating
- codeforces Good Bye 2016-C New Year and Rating(二分)
- Good Bye 2016 C. New Year and Rating(模拟)
- 239. Sliding Window Maximum
- tensorflow 实现线性回归
- 造轮子的前戏---依赖制作
- ios上怎么开启neon
- 一个Activity中多个Fragment实现沉浸式状态栏
- CF 750C New Year and Rating
- eval和with对性能的影响
- 关于Android拍照的一个问题
- error C2275: “XXXX”: 将此类型用作表达式非法
- caffe源码:Layer
- 大型网站架构之分布式消息队列
- caffe训练主要流程
- Go by Example: JSON
- c++浅拷贝和深拷贝