結果

問題 No.1236 長針と短針
ユーザー AngrySadEightAngrySadEight
提出日時 2020-09-25 21:29:42
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,021 bytes
コンパイル時間 1,620 ms
コンパイル使用メモリ 167,668 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 14:55:50
合計ジャッジ時間 2,751 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int A,B;
    cin >> A >> B;
    int sec;
    if (A >= 12) sec = (A - 12) * 3600 + B * 60;
    else sec = A * 3600 + B * 60;
    vector<int> ans(0);
    ans.push_back(0);
    ans.push_back(27 + 5 * 60 + 3600);
    ans.push_back(54 + 10 * 60 + 2 * 3600);
    ans.push_back(21 + 16 * 60 + 3 * 3600);
    ans.push_back(49 + 21 * 60 + 4 * 3600);
    ans.push_back(16 + 27 * 60 + 5 * 3600);
    ans.push_back(43 + 32 * 60 + 6 * 3600);
    ans.push_back(10 + 38 * 60 + 7 * 3600);
    ans.push_back(38 + 43 * 60 + 8 * 3600);
    ans.push_back(5 + 49 * 60 + 9 * 3600);
    ans.push_back(32 + 54 * 60 + 10 * 3600);
    ans.push_back(12 * 3600);
    int min_ans = 86400;
    rep(i,12){
        if (sec <= ans[i]){
            min_ans = min(min_ans,ans[i] - sec);
        }
    }
    cout << min_ans << endl;
}
0