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. MongoDB 3.6 开启慢查询

    参考:Profiling Levels:支持一下级别.0 默认的profiler level,profiler 关闭并且不收集数据.1 profiler 收集超过slowms的操作数据.2 profi ...

  2. python 装饰器 第十一步:多层装饰器的嵌套

    #第十一步:多层装饰器的嵌套 #装饰器1 def kuozhan1(func): #定义装饰之后的函数 def neweat1(): # 扩展功能1 print('1-----饭前洗手') # 调用基 ...

  3. 蓝桥杯:排它平方数-java

    问题描述: 小明正看着 203879 这个数字发呆.原来,203879 * 203879 = 41566646641这有什么神奇呢?仔细观察,203879 是个6位数,并且它的每个数位上的数字都是不同 ...

  4. 深入理解__proto__ 、constructor和prototype的关系

    深入理解__proto__ .constructor和prototype的关系 2013-11-12 09:56 1390人阅读 评论(3) 收藏 举报  分类: 前端之Javascript(59)  ...

  5. JS原型与原型链终极详解 (转载)

    这篇文章需要认认真真仔仔细细的看才能看懂 一. 普通对象与函数对象  JavaScript 中,万物皆对象!但对象也是有区别的.分为普通对象和函数对象,Object ,Function 是JS自带的函 ...

  6. javaIO流(五)--对象序列化

    一.序列化概念 几乎只要是我们的java开发,就一定会存在有序列化的概念,而正是有序列化的概念逐步发展,慢慢也有了更多的系列化的标准.--所谓的对象序列化指的是将内存中保存的对象,以二进制数据流的形式 ...

  7. python学习第四天-函数

    函数  def开头 函数参数 其中name.age.sex为形参,'王锦时',21,'男'为实参 函数返回值 默认参数 关键字参数 收集参数 相当于把所有实参存在一个元组当中 收集参数和关键字参数的混 ...

  8. ConcurrentHashMap(锁分段技术)

    线程不安全的HashMap     因为多线程环境下,使用Hashmap进行put操作会引起死循环,导致CPU利用率接近100%,所以在并发情况下不能使用HashMap.   效率低下的HashTab ...

  9. min-element & max_element

    C++ STL之min_element()与max_element()(取容器中的最大最小值) min_element()和max_element 头文件:#include<algorithm& ...

  10. mysql控制台的一些技巧,显示,输入换行,语法正则等

    注释: 以/**注释内容**/ mysql> /**列出所有的数据库**/ show databases; +--------------------+ | Database | +------ ...