結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-04-13 00:44:58 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 38 ms / 5,000 ms | 
| コード長 | 915 bytes | 
| コンパイル時間 | 315 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 52,224 KB | 
| 最終ジャッジ日時 | 2024-10-02 23:53:33 | 
| 合計ジャッジ時間 | 958 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
class Time:
    def __init__(self, s: str) -> None:
        f = s.find(":")
        self.h = int(s[0:f])
        self.m = int(s[f+1:])
    def __add__(self, other):
        time = Time("00:00")
        time.h = self.h+other.h
        time.m = self.m+other.m
        time.h += int(time.m/60)
        time.m %= 60
        return time
    def __sub__(self, other):
        time = Time("00:00")
        time.h = self.h-other.h
        time.m = self.m-other.m
        
        if time.m < 0:
            time.h -= 1
            time.m %= 60
        time.h %= 24
        return time
    def show(self):
        print(f"{self.h}:{self.m}")
    def __str__(self):
        return str(self.h*60+self.m)
def main():
    cnt = Time("00:00")
    n = int(input())
    for i in range(n):
        a, b = input().split()
        cnt += (Time(b)-Time(a))
    print(cnt)
    # cnt.show()
if __name__ == "__main__":
    main()
            
            
            
        