判断 Gym 100502K Train Passengers
/*
题意:几个判断,车上的人不能 <0 或 > C;车上初始和结束都不能有人在 (为0);车上满员时才有等候的人
水题:难点在于读懂题目意思,状态不佳,一直没搞懂意思,在这题卡住了
主要要理解have to wait 的意思
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std; const int MAXN = 1e2 + ;
const int INF = 0x3f3f3f3f;
int l[MAXN], e[MAXN], w[MAXN]; int main(void) //Gym 100502K Train Passengers
{
//freopen ("K.in", "r", stdin); int C, n; while (scanf ("%d%d", &C, &n) == )
{
int i;
for (i=; i<=n; ++i)
{
scanf ("%d%d%d", &l[i], &e[i], &w[i]);
}
long long sum = ;
for (i=; i<=n; ++i)
{
if (i == n && w[i] > ) {puts ("impossible"); break;};
sum -= l[i];
if (sum < || sum > C) {puts ("impossible"); break;};
sum += e[i];
if (sum < || sum > C) {puts ("impossible"); break;};
if (w[i] > && sum < C) {puts ("impossible"); break;}; //当时没理解题意,写不出来:)
} if (i > n)
{
if (sum != ) puts ("impossible");
else puts ("possible");
}
} return ;
} /*
impossible
possible
*/
判断 Gym 100502K Train Passengers的更多相关文章
- CodeForcesGym 100502K Train Passengers
Train Passengers Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForces ...
- 【模拟】NCPC 2014 K Train passengers
题目链接: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1797 题目大意: 有N个车站,火车一共可以坐M个人,每个车站下车Ai,上车Bi个人,在 ...
- Airbnb新用户的民宿预定结果预测
1. 背景 关于这个数据集,在这个挑战中,您将获得一个用户列表以及他们的人口统计数据.web会话记录和一些汇总统计信息.您被要求预测新用户的第一个预订目的地将是哪个国家.这个数据集中的所有用户都来自美 ...
- 深度学习原理与框架-图像补全(原理与代码) 1.tf.nn.moments(求平均值和标准差) 2.tf.control_dependencies(先执行内部操作) 3.tf.cond(判别执行前或后函数) 4.tf.nn.atrous_conv2d 5.tf.nn.conv2d_transpose(反卷积) 7.tf.train.get_checkpoint_state(判断sess是否存在
1. tf.nn.moments(x, axes=[0, 1, 2]) # 对前三个维度求平均值和标准差,结果为最后一个维度,即对每个feature_map求平均值和标准差 参数说明:x为输入的fe ...
- HDU 1022 Train Problem I[给出两个长n的串,入栈和出栈顺序,判断入栈顺序是否可以匹配出栈顺序]
Train Problem I 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述 As the new term comes, the Ignatius Train Sta ...
- L - The Shortest Path Gym - 101498L (dfs式spfa判断负环)
题目链接:https://cn.vjudge.net/contest/283066#problem/L 题目大意:T组测试样例,n个点,m条边,每一条边的信息是起点,终点,边权.问你是不是存在负环,如 ...
- Gym 100883J palprime(二分判断点在凸包里)
题意:判断一堆小点有多少个在任意三个大点构成的三角形里面. 思路:其实就是判断点在不在凸包里面,判断的话可以使用二分来判断,就是判断该点在凸包的哪两个点和起点的连线之间. 代码: /** @xigua ...
- Codeforces Gym 100523K K - Cross Spider 计算几何,判断是否n点共面
K - Cross SpiderTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/v ...
- Organize Your Train part II-POJ3007模拟
Organize Your Train part II Time Limit: 1000MS Memory Limit: 65536K Description RJ Freight, a Japane ...
随机推荐
- cocos2d-x避免手动修改android.mk文件来编译
编辑android.mk文件,替换为如下内容 LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir) include $(CLEAR_VAR ...
- HTTP长连接短连接
一.什么是长连接 HTTP1.1规定了默认保持长连接(HTTP persistent connection ,也有翻译为持久连接),数据传输完成了保持TCP连接不断开(不发RST包.不四次握手),等待 ...
- git初学者这样就行了。
Create a new repository on the command line touch README.md git init git add README.md git commit -m ...
- linux下vim命令详解 转自: zhanglong0426
高级一些的编辑器,都会包含宏功能,vim当然不能缺少了,在vim中使用宏是非常方便的: :qx 开始记录宏,并将结果存入寄存器xq 退出记录模式@x 播放记录在x寄存器中的 ...
- 阿里云服务器配置 SVN 服务器与生产站点同步
作为linux的门外汉,一直觊觎svn的方便性,在有台aliyun的情况下,一起来搞搞. 1.环境 阿里云 centos5.5 2.安装svn yum -y install subve ...
- IP地址,子网掩码,默认网关
IP地址: 是给每个连接在Internet上的主机分配的一个32bit地址. 地址有两部分组成,一部分为网络地址,另一部分为主机地址. IP地址分为A.B.C.D.E 5类.常用的是B和C两类. 网络 ...
- 【Spring】Spring系列4之Spring支持JDBC
4.Spring支持JDBC 4.1.使用JdbcTemplate简化JDBC开发 也可以这么用(不推荐): 4.2.使用NamedParameterJdbcTemplate
- Flip Game I && II
Flip Game I Problem Description: You are playing the following Flip Game with your friend: Given a s ...
- python下的MySQLdb使用
下载安装MySQLdb <1>linux版本 http://sourceforge.net/projects/mysql-python/ 下载,在安装是要先安装setuptools,然后在 ...
- kettle转换JavaScript加载外部js文件
日常开发中,时常会出现这样一种情况.有大量的函数是通用的.而每个JavaScript里面写一遍,给维护带来很大的困扰.因而需要将公共的函数写在外部js文件中.这时就需要引入外部的公共文件了.下面是在转 ...