結果

問題 No.652 E869120 and TimeZone
ユーザー wildwild
提出日時 2018-02-23 23:51:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,387 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 79,500 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 20:11:26
合計ジャッジ時間 1,639 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 WA -
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 1 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
using namespace std;

int main(){
  int a, b,c = -9999;
  string s;
  cin >> a >> b >> s;
  int ina = a;
  int inb = b;

  int seisuu = -9999, syousuu = -9999;

  string left, right;

  s = s.substr(3);
  if (s.find('.') == string::npos) {
    seisuu = stoi(s) - 9;
    a += seisuu;
    if (a < 0) a = 24+a;
    else a = a%24;
    left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a);
    right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b);
    cout << left << ":"  <<  right << endl;
    return 0;
  }


  int pos = s.find('.');
  seisuu = stoi(s.substr(0, pos)) - 9;
  syousuu = stoi(s.substr(pos+1)) * 6;

  if (seisuu < 0) {
    a += seisuu;
    b = (b + syousuu)%60;
    if (a < 0) a = 24+a;
    else a = a%24;
    left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a);
    right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b);
    cout << left << ":"  <<  right << endl;
    return 0;
  }

  a = a + seisuu;
  b = b + syousuu;
  a += b/60;
  b = b%60;
  if (a < 0) a = 24+a;
  else a = a%24;
  left = (to_string(a).length() == 1)? "0" + to_string(a): to_string(a);
  right = (to_string(b).length() == 1)? "0" + to_string(b): to_string(b);
  cout << left << ":"  <<  right << endl;
}
0