結果
| 問題 |
No.1236 長針と短針
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-11 15:07:47 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 819 bytes |
| コンパイル時間 | 2,857 ms |
| コンパイル使用メモリ | 244,372 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-08-11 15:07:51 |
| 合計ジャッジ時間 | 3,933 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | WA * 20 |
ソースコード
// #define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
int A,B;
double time_mod(double x){
while(x>0)x-=360;
while(x<0)x+=360;
if(abs(x)<abs(x-360))return x;
return x-360;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
cout<<fixed<<setprecision(15);
cin>>A>>B;A%=12;
double init_A=(double)(360*A)/12 + double(B*360)/(60*12);
double init_B=(double)(360*B)/60;
double now_A=init_A,now_B=init_B;
if(time_mod(now_A-now_B)==0.0){
cout<<0<<endl;
return 0;
}
for(int s=0;s<1e6;s++){
double diff_A=(double)(360*s)/(60*60*12);
double diff_B=(double)(360*s)/(60*60);
if(time_mod(now_A-now_B)*time_mod((init_A+diff_A)-(init_B+diff_B))<=0){
cout<<s<<endl;
return 0;
}
now_A=init_A+diff_A;
now_B=init_B+diff_B;
}
}