結果
| 問題 | No.70 睡眠の重要性! | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-03-30 14:44:31 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 696 bytes | 
| コンパイル時間 | 689 ms | 
| コンパイル使用メモリ | 64,980 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-02 08:09:34 | 
| 合計ジャッジ時間 | 1,131 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
vector<string> conv(string s) {
    istringstream iss(s); string tmp; vector<string> vec;
    while (getline(iss, tmp, ':')) vec.push_back(tmp);
    return vec;
}
int func(string s) {
    vector<string> vec;
    vec = conv(s);
    int a = 0, b = 0;
    a = stoi(vec.at(0));
    b = stoi(vec.at(1));
    return a * 60 + b;
}
int main() {
    int n;
    cin >> n;
    int a = 0, b = 0, ans = 0;
    string x, y;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        a = func(x);
        b = func(y);
        ans += ((1440 + b - a) % 1440);
    }
    cout << ans <<endl;
    return 0;
}
            
            
            
        