Congestion Charging Zon

题目描述

Tehran municipality has set up a new charging method for the Congestion Charging Zone (CCZ) which controls the passage of vehicles in Tehran’s high-congestion areas in the congestion period (CP) from 6:30 to 19:00. There are plate detection cameras inside or at the entrances of the CCZ recording vehicles seen at the CCZ. The table below summarizes the new charging method.

点此查看图片

Note that the first time and the last time that a vehicle is seen in the CP may be the same. Write a program to compute the amount of charge of a given vehicle in a specific day.

输入

The first line of the input contains a positive integer n (1 ⩽ n ⩽ 100) where n is the number of records for a vehicle. Each of the next n lines contains a time at which the vehicle is seen. Each time is of form :, where is an integer number between 0 and 23 (inclusive) and is formatted as an exactly two-digit number between 00 and 59 (inclusive).

输出

Print the charge to be paid by the owner of the vehicle in the output.

样例输入

4
7:30
2:20
7:30
17:30

样例输出

36000

题解

大模拟

代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define memset(x,y) memset(x,y,sizeof(x))
#define memcpy(x,y) memcpy(x,y,sizeof(y))
#define all(x) x.begin(),x.end()
#define readc(x) scanf("%c",&x)
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define read3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define print(x) printf("%d\n",x)
#define lowbit(x) x&-x
#define lson(x) x<<1
#define rson(x) x<<1|1
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
typedef long long LL;
typedef long long ll;
const double eps=1e-8;
const double PI = acos(1.0);
const int INF = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll mod = 998244353;
const int MAXN = 1e6+7;
const int maxm = 1;
const int maxn = 100000+10;
int T;
int n,m;
int p1,p2;
int s1,s2;
int x,y;
int ans = 0;
struct node
{
int h,m;
}a[maxn]; bool cmp(node a,node b)
{
if(a.h == b.h)
return a.m >= b.m;
else
return a.h>b.h;
}
int main()
{
int n;
read(n);
node ma,mi;
node st1,st2,st3,st4,st5,st6;
ma.h = 6;
ma.m = 29;
mi.h = 19;
mi.m = 1;
st1.h = 6;
st1.m = 30;
st2.h = 19;
st2.m = 0;
st3.h = 10;
st3.m = 0;
st4.h = 10;
st4.m = 1;
st5.h = 16;
st5.m = 0;
st6.h = 16;
st6.m = 01; rep(i,0,n)
{
node temp;
scanf("%d:%d",&temp.h,&temp.m);
if(cmp(st1,temp)||cmp(temp,st2))
continue;
if(cmp(temp,ma))
{
ma.h = temp.h;
ma.m = temp.m;
}
if(cmp(mi,temp))
{
mi.h = temp.h;
mi.m = temp.m;
}
}
// printf("%d:%d\n",ma.h,ma.m);
// printf("%d:%d\n",mi.h,mi.m);
if(cmp(mi,st1) && cmp(st3,mi) && cmp(ma,st1) && cmp(st5,ma))
printf("24000\n");
else if(cmp(mi,st1) && cmp(st3,mi) && cmp(ma,st6) && cmp(st2,ma))
printf("36000\n");
else if(cmp(mi,st4) && cmp(st5,mi) && cmp(ma,st4) && cmp(st5,ma) )
printf("16800\n");
else if(cmp(mi,st4) && cmp(st2,mi) && cmp(ma,st6) && cmp(st2,ma))
printf("24000\n");
else
printf("0\n"); }

upc组队赛3 Congestion Charging Zon【模拟】的更多相关文章

  1. upc组队赛6 Progressive Scramble【模拟】

    Progressive Scramble 题目描述 You are a member of a naive spy agency. For secure communication,members o ...

  2. upc 组队赛18 STRENGTH【贪心模拟】

    STRENGTH 题目链接 题目描述 Strength gives you the confidence within yourself to overcome any fears, challeng ...

  3. upc组队赛16 WTMGB【模拟】

    WTMGB 题目链接 题目描述 YellowStar is very happy that the FZU Code Carnival is about to begin except that he ...

  4. upc组队赛15 Lattice's basics in digital electronics【模拟】

    Lattice's basics in digital electronics 题目链接 题目描述 LATTICE is learning Digital Electronic Technology. ...

  5. upc组队赛18 THE WORLD【时间模拟】

    THE WORLD 题目链接 题目描述 The World can indicate world travel, particularly on a large scale. You mau be l ...

  6. upc组队赛1 过分的谜题【找规律】

    过分的谜题 题目描述 2060年是云南中医学院的百年校庆,于是学生会的同学们搞了一个连续猜谜活动:共有10个谜题,现在告诉所有人第一个谜题,每个谜题的答案就是下一个谜题的线索....成功破解最后一个谜 ...

  7. upc组队赛4 Go Latin

    Go Latin 题目描述 There are English words that you want to translate them into pseudo-Latin. To change a ...

  8. upc组队赛3 Chaarshanbegaan at Cafebazaar

    Chaarshanbegaan at Cafebazaar 题目链接 http://icpc.upc.edu.cn/problem.php?cid=1618&pid=1 题目描述 Chaars ...

  9. upc组队赛1 不存在的泳池【GCD】

    不存在的泳池 题目描述 小w是云南中医学院的同学,有一天他看到了学校的百度百科介绍: 截止到2014年5月,云南中医学院图书馆纸本藏书74.8457万册,纸质期刊388种,馆藏线装古籍图书1.8万册, ...

随机推荐

  1. Tex与PDF

    由Knuth Donald开发的tex.web会生成DVI文件,DVI也是Knuth自己实现的(虽然概念是其他人提出的)一种文件格式,目标是与设备无关. 通过dvips程序可以将DVI格式转化成Pos ...

  2. shell ## %% 变量内容的删除、替代和替换

    这个写的很清楚: https://www.cnblogs.com/zhaosunwei/p/6831529.html 自己的理解:以后补充 从前向后删除 # 符合替换字符的“最短的”那个 ## 符合替 ...

  3. 关于曲线 规划 算法 线性 S曲线 贝塞尔曲线

    工控领域经常会涉及速度加减速的算法:线性加减速,S曲线加减速(sin函数,拓展其他三角函数曲线), 贝塞尔曲线,等等. 线性加减速:    设定起始速度V0,目标速度V1,加速时间Ta(s,或加速度) ...

  4. .gz文件解压

    有时我们明明已经使用gunzip命令解压.gz文件了,可解压生成的文件却依然无法正常读取.如输入命令gunzip HelloWorld.java.gz后,解压生成HelloWorld.java文件,却 ...

  5. Git SSH连接方式配置

    如果使用ssh的方式管理,需要配置ssh key. 1.打开git bash命令窗口 2.生成ssh key ssh-keygen -t rsa -b 4096 -C "your_email ...

  6. XX-net 3.11.9 登陆Google等出现没有开启cookie的问题

    糟糕!您的浏览器似乎禁用了 Cookie.请务必启用 Cookie 或尝试打开一个新的浏览器窗口. 出现这个问题解决方法: 1.配置好X-tunnel,即登录账号2.打开谷歌浏览器或者你用的浏览器,设 ...

  7. 分布式ID的雪花算法及坑

    分布式ID生成是目前系统的常见刚需,其中以Twitter的雪花算法(Snowflake)比较知名,有Java等各种语言的版本及各种改进版本,能生成满足分布式ID,返回ID为Long长整数 但是这里有一 ...

  8. MYSQL中常用的工具

    1.mysql(客户端链接工具):   -u :指定用户名   -p:指定密码   -h:指定服务器ip或者域名   -P(大写):指定端口  例子:mysql -u root -h 202.194. ...

  9. 利用hover,制作点击有缩放效果

    .tab-pic-wrap .pic-wrap .list li a:hover img { transform: scale(1.03); } .tab-pic-wrap .pic-wrap .li ...

  10. HttpClient 之 发送Https请求

    HttpClient包是一个优秀的Http请求的开源jar. 本文Http工具类的封装基于HttpClient,封装后的工具类支持Https请求. 但是由于项目的需要快速的实现,以下代码还可能会有点过 ...