L1-043 阅览室 (20 分)

摘要
Title: L1-043 阅览室 (20 分)
Tag: 模拟
Memory Limit: 64 MB
Time Limit: 1000 ms

Powered by:NEFU AB-IN

Link

L1-043 阅览室 (20 分)

  • 题意

    见原题

  • 思路

    感觉测试数据不太对,题目数据是以最后一次借为主的

  • 代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    '''
    Author: NEFU AB-IN
    Date: 2022-04-15 19:55:54
    FilePath: \ACM\GPLT\L1-043.PY
    LastEditTime: 2022-04-15 19:59:52
    '''
    from collections import Counter

    S = Counter()

    n = int(input())

    while n > 0:
    cnt, time_sum = 0, 0
    while True:
    index, op, time = input().split()
    h, f = map(int, time.split(':'))
    if index == '0':
    if cnt == 0:
    print(0, 0)
    else:
    print(cnt, int((time_sum / cnt) + 0.5))
    break
    if op == 'S':
    # if S[index]:
    # continue
    S[index] = [h, f]
    else:
    if not S[index]:
    continue
    time_sum += (h - S[index][0]) * 60 + (f - S[index][1])
    S[index] = 0
    cnt += 1
    n -= 1
使用搜索:谷歌必应百度