zoukankan      html  css  js  c++  java
  • upc组队赛3 Congestion Charging Zon【模拟】

    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
    ",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
    ",ma.h,ma.m);
        // printf("%d:%d
    ",mi.h,mi.m);
        if(cmp(mi,st1) && cmp(st3,mi) && cmp(ma,st1) && cmp(st5,ma))
          printf("24000
    ");
        else if(cmp(mi,st1) && cmp(st3,mi) && cmp(ma,st6) && cmp(st2,ma))
          printf("36000
    ");
        else if(cmp(mi,st4) && cmp(st5,mi) && cmp(ma,st4) && cmp(st5,ma) )
          printf("16800
    ");
        else if(cmp(mi,st4) && cmp(st2,mi) && cmp(ma,st6) && cmp(st2,ma))
          printf("24000
    ");
        else
          printf("0
    ");
     
     
    }
    
  • 相关阅读:
    寒假Day31:CSU1508地图的四着色bfs+dfs
    寒假Day32:链式前向星
    寒假Day30:HDU4507吉哥系列故事恨7不成妻数位dp
    寒假Day35:HTML表格+图像+超链接
    寒假Day35:2018蓝桥杯 B组
    寒假Day33:HTML入门
    寒假Day30:二叉树的遍历相关题型(求先序或后序、搜索树的判断)
    POJ 1177 Picture (线段树+离散化+扫描线) 详解
    MFC对话框中文出现乱码的解决方法
    如何枚举系统COM串口
  • 原文地址:https://www.cnblogs.com/llke/p/10799949.html
Copyright © 2011-2022 走看看