結果

問題 No.1236 長針と短針
ユーザー Mister
提出日時 2020-09-25 21:47:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 66,856 KB
最終ジャッジ日時 2025-01-14 20:45:32
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

constexpr int T = 60 * 60 * 12;

void solve() {
    int a, b;
    std::cin >> a >> b;

    int t = a * 3600 + b * 60;
    int h = t % T, m = t * 12 % T;

    if (m > h) m -= T;

    int ans = 0;
    while (m <= h) {
        m += 12;
        h += 1;
        ++ans;
    }
    std::cout << ans - 1 << "\n";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0