結果

問題 No.70 睡眠の重要性!
ユーザー Naoyk1212Naoyk1212
提出日時 2017-06-14 17:24:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 931 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 73,560 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 03:14:38
合計ジャッジ時間 1,105 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
const int MOD = 1e9 + 7;

int solve(){
    int h, m, hh, mm;
    char c;
    cin >> h >> c >> m >> hh >> c >> mm;

    int ret = 0;
    if(h > hh){
        ret += (24 - h - 1) * 60;
        ret += 60 - m;
        ret += hh * 60;
        ret += mm;
    }else if(h == hh){
        if(m > mm){
            ret += 23 * 60;
            ret += 60 - (m - mm);
        }else{
            ret += mm - m;
        }
    }else{
        if(m < mm){
            ret += (hh - h) * 60;
            ret += mm - m;
        }else{
            ret += (hh - h - 1) * 60;
            ret += 60 - (m - mm);
        }
    }
    return ret;
}
int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += solve();
    }
    cout << ans << endl;
}
0