結果
| 問題 | 
                            No.1236 長針と短針
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-11-06 22:29:40 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 7 ms / 2,000 ms | 
| コード長 | 646 bytes | 
| コンパイル時間 | 2,012 ms | 
| コンパイル使用メモリ | 197,836 KB | 
| 最終ジャッジ日時 | 2025-01-15 20:59:28 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |   scanf("%02d %02d", &h0, &m0);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()
const double PI = acos(-1);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int h0, m0;
  scanf("%02d %02d", &h0, &m0);
  set<int> hit;
  for (int h = 0; h <= 10; h++) {
    int t = 3600 * 12 * h / 11;
    hit.insert(t);
  }
  int cur = (h0 * 60 + m0) * 60;
  cur %= 12 * 60 * 60;
  for (int i = 0; ; i++) {
    int t = (cur + i) % (60 * 60 * 12);
    if (hit.count(t)) {
      cout << i << endl;
      break;
    }
  }
  
  return 0;
}