結果

問題 No.70 睡眠の重要性!
ユーザー soragsorag
提出日時 2022-08-17 21:27:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 797 bytes
コンパイル時間 852 ms
コンパイル使用メモリ 77,596 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 09:28:12
合計ジャッジ時間 1,723 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<utility>
#include <vector>
#include <map>
#include<string>
#include<queue>
#include<math.h>
#define pb push_back
#define all(x) begin(x),end(x)
#define ll long long
#define P pair<int,int>
#define lP pait<ll,ll>
using namespace std;
int main() {
    int n,cnt=0;
    cin>>n;
    for(int i=0;i<n;i++){
        int a,b,c,d;
        char e,f;
        cin>>a>>e>>b>>c>>f>>d;
        if(a>c){
            if(b>=d) cnt+=60*((24-a)+c-1)+60-b+d;
            else if(b<d) cnt+=60*((24-a)+c)+d-b;
        }
        else if(a==c){
            if(d>=b) cnt+=d-b;
            else if(d<b)  cnt+=60*24-b;
        }
        else{
            if(d>=b) cnt+=60*(c-a)+d-b;
            else if(d<b)  cnt+=60*(c-a-1)+60-b+d;
        }
    }
    cout<<cnt<<endl;
    return 0;
}
  
    

0