結果
| 問題 | 
                            No.652 E869120 and TimeZone
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Dameningen
                         | 
                    
| 提出日時 | 2018-02-24 03:52:58 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 1,593 bytes | 
| コンパイル時間 | 3,673 ms | 
| コンパイル使用メモリ | 139,392 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-11 12:21:19 | 
| 合計ジャッジ時間 | 4,397 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 30 | 
ソースコード
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int main() {
  int a, b;
  string s;
  cin >> a >> b;
  cin >> s;
  int h = 0, m = 0;
  if (s[3] == '+') {
    if (s.size() == 5) {
      h = int(s[4]-'0') - 9;
    } else if (s.size() == 6) {
      h = int(s[4]-'0')*10 + int(s[5]-'0') - 9;
    } else if (s.size() == 7) {
      h = int(s[4]-'0') - 9;
      m = int(s[6]-'0') * 6;
    } else {
      h = int(s[4]-'0')*10 + int(s[5]-'0') - 9;
      m = int(s[7]-'0') * 6;
    }
  } else if (s[3] == '-') {
    if (s.size() == 5) {
      h = -int(s[4]-'0') - 9;
    } else if (s.size() == 6) {
      h = -int(s[4]-'0')*10 - int(s[5]-'0') - 9;
    } else if (s.size() == 7) {
      h = -int(s[4]-'0') - 9;
      m = -int(s[6]-'0') * 6;
    } else {
      h = -int(s[4]-'0')*10 - int(s[5]-'0') - 9;
      m = -int(s[7]-'0') * 6;
    }
  }
  a += h;
  b += m;
  if (b < 0) {
    --a; b = 60 + b;
  } else if (b >= 60) {
    ++a; b %= 60;
  }
  if (a < 0) {
    a = 24 + a;
  } else if (a >= 24) {
    a %= 24;
  }
  printf("%02d:%02d\n", a, b);
  return 0;
}
            
            
            
        
            
Dameningen