結果
| 問題 |
No.1236 長針と短針
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-10-07 14:34:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,590 bytes |
| コンパイル時間 | 1,890 ms |
| コンパイル使用メモリ | 195,208 KB |
| 最終ジャッジ日時 | 2025-01-15 03:13:40 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
// verification-helper: PROBLEM https://yukicoder.me/problems/4941
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
struct fraction{
T num,dom;
fraction(){}
fraction(T n,T d):num(n),dom(d){
assert(dom!=0);
if(dom<0) num*=-1,dom*=-1;
T tmp=__gcd(abs(num),abs(dom));
num/=tmp;
dom/=tmp;
}
fraction operator+(const fraction a) const{
return fraction(num*a.dom+a.num*dom,dom*a.dom);
}
fraction operator-(const fraction a) const{
return fraction(num*a.dom-a.num*dom,dom*a.dom);
}
fraction operator*(const fraction a) const{
return fraction(num*a.num,dom*a.dom);
}
fraction operator/(const fraction a){
return fraction(num*a.dom,dom*a.num);
}
fraction operator*(T k) const{return fraction(num*k,dom);}
fraction operator/(T k) const{return fraction(num,dom*k);}
#define define_cmp(op) \
bool operator op (const fraction a)const{return num*a.dom op a.num*dom;}
define_cmp(==)
define_cmp(!=)
define_cmp(<)
define_cmp(>)
define_cmp(<=)
define_cmp(>=)
#undef define_cmp
};
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
return 0;
}
#endif
#undef call_from_test
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
string s,t;
cin>>s>>t;
int a=(s[0]-'0')*10+(s[1]-'0');
int b=(t[0]-'0')*10+(t[1]-'0');
using F = fraction<int>;
F c(a*60+b,1);
F d(720,11);
F x(0,1);
while(x<c) x=x+d;
x=x-c;
cout<<x.num*60/x.dom<<endl;
return 0;
}
beet