2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B.Train Seats Reservation(模拟)
来源:互联网 发布:固态优化设置 编辑:程序博客网 时间:2024/05/22 05:15
You are given a list of train stations, say from the station 1 to the station 100.
The passengers can order several tickets from one station to another before the train leaves the station one. We will issue one train from the station 1 to the station 100 after all reservations have been made. Write a program to determine the minimum number of seats required for all passengers so that all reservations are satisfied without any conflict.
Note that one single seat can be used by several passengers as long as there are no conflicts between them. For example, a passenger from station 1 to station 10 can share a seat with another passenger from station 30to 60.
Input Format
Several sets of ticket reservations. The inputs are a list of integers. Within each set, the first integer (in a single line) represents the number of orders, n, which can be as large as 1000. After n, there will be n lines representing the n reservations; each line contains three integers s,t,k, which means that the reservation needs k seats from the station s to the station t .These ticket reservations occur repetitively in the input as the pattern described above. An integer n=0 (zero) signifies the end of input.
Output Format
For each set of ticket reservations appeared in the input, calculate the minimum number of seats required so that all reservations are satisfied without conflicts. Output a single star '*' to signify the end of outputs.
样例输入
21 10 820 50 2032 30 520 80 2040 90 400
样例输出
2060*
题解:
直接用一个长度为100的数组,每次在s,t段加上数字k,最后扫一遍数组求最大值就行了。。
签到题,一开始我模拟的是错的,因为如果s==t的时候输出0我模拟错了,后来老赵a了,就不给代码了
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B.Train Seats Reservation(模拟)
- ACM 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation
- B. Train Seats Reservation 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B Train Seats Reservation
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 Train Seats Reservation
- Train Seats Reservation 区间加减 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛:Train Seats Reservation
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation(贪心问题+区间覆盖)
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛-- B. Train Seats Reservation-(区间更新,单点查询思想)
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation 和 F. Overlapping Rectangles
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛Train Seats Reservation(树状数组的运用)
- 2017 icpc 南宁赛区 B.Train Seats Reservation(水题)
- Train Seats Reservation 2017ACM南宁网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛
- 2017南宁网络赛B.Train Seats Reservation(初级扫描)
- 第四周——项目四—建设双链表算法库
- Docker构建Redis集群
- uva 10369 最小生成树
- 并发编程复习(十):master和worker模式
- 图像阈值
- 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B.Train Seats Reservation(模拟)
- 杂谈
- BCC – 用于Linux性能监视,网络和更多的动态跟踪工具
- java序列化和反序列化的理解
- Map 接口的其他实现类
- spingmvc的请求流程
- Online algorithms for uploading deferrable big data to the cloud文章阅读笔记
- JS总结--------BOM常用对象
- Python对象的属性访问过程