zoukankan      html  css  js  c++  java
  • L1-043 阅览室

    这题也是写了可长时间:
    #include <stdio.h>  
    #include <iostream>  
    #include <stack>  
    #include <string.h>  
    #include <queue>  
    #include <cmath>  
    #include <vector>  
    #include <algorithm>  
    #include <map>  
    #include <set>  
    #include <string>  
    using namespace std;  
    typedef long long LL;  
    map<int, char> a;  
    map<int, int> b;  
    int main() {  
        //freopen("in.txt", "r", stdin);  
        //freopen("out.txt","w",stdout);  
        int n;  
        cin >> n;  
        while(n--){  
            double time = 0;  
            int sum  = 0;  
            a.clear();  
            b.clear();  
            int num, begin, end;  
            char status;  
            while(scanf("%d %c %d:%d", &num, &status, &begin, &end)){  
                if(num == 0) break;  
                if(status == 'S'){  
                    a[num] = 'S';  
                    b[num] = begin * 60 + end;  
                }  
                if(status == 'E'){  
                    if(a[num] == 'S'){  
                        time += begin * 60 + end - b[num];  
                        sum ++;  
                        a[num] = '0';  
                    }  
                }  
            }  
            if(sum != 0){  
                time = time / sum;  
            }  
            int t = time + 0.5;  
            printf("%d %d
    ",sum,t);  
        }  
      
        return 0;  
    }  
  • 相关阅读:
    linux
    网络编址
    抽象类 接口
    mysql
    java
    [lyu]Mysql解压版安装教程
    Mysql出现拒绝本地账户访问的情况副本
    js
    Redis限流和GeoHash
    布隆过滤器
  • 原文地址:https://www.cnblogs.com/nr1999/p/8603967.html
Copyright © 2011-2022 走看看