結果
問題 | No.70 睡眠の重要性! |
ユーザー |
|
提出日時 | 2024-10-03 13:46:53 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,353 bytes |
コンパイル時間 | 2,633 ms |
コンパイル使用メモリ | 121,048 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-03 13:46:56 |
合計ジャッジ時間 | 1,780 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
ソースコード
#include <iostream> #include <math.h> #include <algorithm> #include <map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, d, n) for (int i = d; i < (int)(n); i++) #define rRep(i,n) for(int i = n; i >= 0; i--) #define rRep2(i,d,n) for(int i = n; i >= d; i--) #define forEach(arr) for (auto& it:arr) int main(void){ int n,sleep = 0; cin >> n; rep(i,n) { string a,b,a1[2] = {"",""},b1[2] = {"",""}; int c,d; cin >> a >> b; vector<string> v1,v2; bool f = false; for(int i = 0; i < a.length(); i++) { if(f) a1[1] += a[i]; else { if(a[i] == ':') { f = true; continue; } a1[0] += a[i]; } } f = false; for(int i = 0; i < b.length(); i++) { if(f) b1[1] += b[i]; else { if(b[i] == ':') { f = true; continue; } b1[0] += b[i]; } } c = stoi(a1[0]) * 60 + stoi(a1[1]); d = stoi(b1[0]) * 60 + stoi(b1[1]); if(d < c)d += (24 * 60); sleep += d - c; } cout << sleep; }