• hud 1103 作业


    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <string>
    #include <set>
    #include <queue>
    #include <map>
    #include <sstream>
    #include <cstdio>
    #include <cstring>
    #include <numeric>
    #include <cmath>
    #include <iomanip>
    #include <deque>
    #include <bitset>
    #include <cassert>
    //#include <unordered_set>
    //#include <unordered_map>
    #define ll              long long
    #define pii             pair<int, int>
    #define rep(i,a,b)      for(int  i=a;i<=b;i++)
    #define dec(i,a,b)      for(int  i=a;i>=b;i--)
    #define forn(i, n)      for(int i = 0; i < int(n); i++)
    using namespace std;
    int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
    const long long INF = 0x7f7f7f7f7f7f7f7f;
    const int inf = 0x3f3f3f3f;
    const double pi = acos(-1.0);
    const double eps = 1e-6;
    const int mod = 1e9 + 7;
    
    inline ll read()
    {
        ll x = 0; bool f = true; char c = getchar();
        while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
        while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
        return f ? x : -x;
    }
    inline ll gcd(ll m, ll n)
    {
        return n == 0 ? m : gcd(n, m % n);
    }
    void exgcd(ll A, ll B, ll& x, ll& y)
    {
        if (B) exgcd(B, A % B, y, x), y -= A / B * x; else x = 1, y = 0;
    }
    inline int qpow(int x, ll n) {
        int r = 1;
        while (n > 0) {
            if (n & 1) r = 1ll * r * x % mod;
            n >>= 1; x = 1ll * x * x % mod;
        }
        return r;
    }
    inline int inv(int x) {
        return qpow(x, mod - 2);
    }
    ll lcm(ll a, ll b)
    {
        return a * b / gcd(a, b);
    }
    /**********************************************************/
    const int N = 1e5 + 5;
    
    int main()
    {
    
        int a, b, c;
        while (cin >> a >> b >> c, a, b, c)
        {
            priority_queue<int, vector<int>, greater<int> > pq[4];
            rep(i, 1, a)
                pq[1].push(0);
            rep(i, 1, b)
                pq[2].push(0);
            rep(i, 1, c)
                pq[3].push(0);
            string s;
            int res = 0;
            while (cin >> s && s != "#")
            {
                int num;
                cin >> num;
                int t = ((s[0] - '0') * 10 + (s[1] - '0')) * 60 + ((s[3] - '0') * 10 + (s[4] - '0'));
                int id = (num + 1) / 2;
                if (t + 30 >= pq[id].top())
                {
                    int tmp = max(pq[id].top(),t);
                    pq[id].pop();
                    pq[id].push(tmp+30);
                    res += num;
                }
            }
            cout << res << endl;
        }
        return 0;
    }
  • 相关阅读:
    2、MySQL语法规范 与 注释
    5、手写代码实现MyBatis的查询功能
    1、MySQL常见的操作命令
    操作系统(五)——文件
    操作系统(四)——内存
    操作系统(三)——信号量、死锁
    操作系统(二)——进程与线程
    操作系统(一)——概述和进程与线程基础
    多线程与并发(四)——线程池、原子性
    开课博客
  • 原文地址:https://www.cnblogs.com/dealer/p/13592379.html
Copyright © 2020-2023  润新知