You are given a list of train stations, say from the station 11 to
the station 100100.

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 11 to
the station 100100 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 11 to
station 1010 can
share a seat with another passenger from station 3030 to 6060.

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, nn,
which can be as large as 10001000.
After nn,
there will be nn lines
representing the nnreservations;
each line contains three integers s,
t, ks,t,k,
which means that the reservation needs kk seats
from the station ss to
the station tt.These
ticket reservations occur repetitively in the input as the pattern described above. An integer n
= 0n=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.

样例输入

2
1 10 8
20 50 20
3
2 30 5
20 80 20
40 90 40
0

样例输出

20
60
*

题目来源

2017
ACM-ICPC 亚洲区(南宁赛区)网络赛

很水的一个题,队友想得及其复杂,就是把1-100分成100段,分别是1-2,2-3,3-4……99-100

对输入的范围进行累加,输出值最大的那个单位段

#include <iostream>
//#include<math.h>
#include<math.h>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn=110;
int train[maxn]; int main()
{
int n;
while(cin>>n)
{
if(n==0)
{
cout<<"*"<<endl;
break;
}
memset(train,0,sizeof(train));
int l,r,num;
int maxsum=0;
for(int j=0;j<n;j++)
{ cin>>l>>r>>num;
for(int i=l;i<r;i++)
{
train[i]+=num;
}
for(int i=0;i<=100;i++)
{
maxsum=max(maxsum,train[i]);
} }
cout<<maxsum<<endl;
}
return 0;
}

2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 Train Seats Reservation的更多相关文章

  1. 2017ICPC南宁赛区网络赛 Train Seats Reservation (简单思维)

    You are given a list of train stations, say from the station 111 to the station 100100100. The passe ...

  2. 2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 M. Frequent Subsets Problem【状态压缩】

    2017 ACM-ICPC 亚洲区(南宁赛区)网络赛  M. Frequent Subsets Problem 题意:给定N和α还有M个U={1,2,3,...N}的子集,求子集X个数,X满足:X是U ...

  3. HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)

    HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: ...

  4. 2016 ACM/ICPC亚洲区青岛站现场赛(部分题解)

    摘要 本文主要列举并求解了2016 ACM/ICPC亚洲区青岛站现场赛的部分真题,着重介绍了各个题目的解题思路,结合详细的AC代码,意在熟悉青岛赛区的出题策略,以备战2018青岛站现场赛. HDU 5 ...

  5. ICPC 2018 徐州赛区网络赛

    ACM-ICPC 2018 徐州赛区网络赛  去年博客记录过这场比赛经历:该死的水题  一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进.     D. Easy Math 题意:   ...

  6. Skiing 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛H题(拓扑序求有向图最长路)

    参考博客(感谢博主):http://blog.csdn.net/yo_bc/article/details/77917288 题意: 给定一个有向无环图,求该图的最长路. 思路: 由于是有向无环图,所 ...

  7. [刷题]ACM/ICPC 2016北京赛站网络赛 第1题 第3题

    第一次玩ACM...有点小紧张小兴奋.这题目好难啊,只是网赛就这么难...只把最简单的两题做出来了. 题目1: 代码: //#define _ACM_ #include<iostream> ...

  8. 2016 ACM/ICPC亚洲区大连站-重现赛 解题报告

    任意门:http://acm.hdu.edu.cn/showproblem.php?pid=5979 按AC顺序: I - Convex Time limit    1000 ms Memory li ...

  9. 2014ACM/ICPC亚洲区鞍山赛区现场赛1009Osu!

    鞍山的签到题,求两点之间的距离除以时间的最大值.直接暴力过的. A - Osu! Time Limit:1000MS     Memory Limit:262144KB     64bit IO Fo ...

随机推荐

  1. [TJOI2010]中位数

    题目描述 给定一个由N个元素组成的整数序列,现在有两种操作: 1 add a 在该序列的最后添加一个整数a,组成长度为N + 1的整数序列 2 mid 输出当前序列的中位数 中位数是指将一个序列按照从 ...

  2. Meeting 加虚拟边

    Bessie and her friend Elsie decide to have a meeting. However, after Farmer John decorated his fence ...

  3. 03-js变量强制转换

    <html> <head> <title>js中的变量强转</title> <meta charset="UTF-8"/> ...

  4. Servlet表单数据处理

    以下内容引用自http://wiki.jikexueyuan.com/project/servlet/form-data.html: 当需要从浏览器到Web服务器传递一些信息并最终传回到后台程序时,一 ...

  5. ETL全量单表同步简述

    ETL全量单表同步简述 1. 实现需求 当原数据库的表有新增.更新.删除操作时,将改动数据同步到目标库对应的数据表. 2. 设计思路 设计总体流程图如下: 注意点: 1.数据库合并时,选择正确的数据源 ...

  6. WCF - 自定义绑定

    自定义绑定 当系统提供的某个绑定不符合服务的要求时,可使用 CustomBinding 类.所有绑定都是从绑定元素的有序集构造而来的.自定义绑定可以从一组系统提供的绑定元素生成,也可以包含用户定义的自 ...

  7. Linux 编译C++ 与 设置 Vim

    1. Linux 下编译c++ vim test.cpp    // 创建文件 g++ test.cpp    // 编译文件 ./a.out         // 执行文件 g++ test.cpp ...

  8. 【hdu3966】Aragorn's Story

    题意:给一棵树,并给定各个点权的值,然后有3种操作:I C1 C2 K: 把C1与C2的路径上的所有点权值加上KD C1 C2 K:把C1与C2的路径上的所有点权值减去KQ C:查询节点编号为C的权值 ...

  9. 关于移动平台的viewport

    viewport是用来设置移动平台上的网页宽度,写device-width比较好,不然会和设备上不一样 在使用device-width之后,图片资源最好使用百分比布局,进行自动缩放. 文字大小是一样的 ...

  10. RK3288获取摄像头的Sensor ID【原创】

    平台信息:内核:linux3.0.68 系统:android/android6.0平台:RK3288 作者:庄泽彬(欢迎转载,请注明作者) 邮箱:2760715357@qq.com 说明:通过I2C总 ...