#line 1 "test/yukicoder/1236.test.cpp" #define PROBLEM "https://yukicoder.me/problems/no/1236" #line 2 "template/template.hpp" //#pragma GCC target("avx") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") #include using namespace std; using ll=long long; using ld=long double; using vl=vector; using vi=vector; using vs=vector; using vc=vector; using vvl=vector; using P=pair; using vvc=vector; using vd=vector; using vp=vector

; using vb=vector; #define overload4(_1,_2,_3,_4,name,...) name #define overload3(_1,_2,_3,name,...) name #define rep1(a) for(__typeof(a) i=0;i=0;i--) #define rrep2(i,a) for(__typeof(a) i=(a)-1;i>=0;i--) #define rrep3(i,a,b) for(__typeof(a) i=(b)-1;i>=(a);i--) #define rrep(...) overload3(__VA_ARGS__,rrep3,rrep2,rrep1)(__VA_ARGS__) #define all1(i) begin(i),end(i) #define all2(i,a) begin(i),begin(i)+a #define all3(i,a,b) begin(i)+a,begin(i)+b #define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__) #define rall(n) (n).rbegin(),(n).rend() #define pb push_back #define eb emplace_back #define MtSaka ios::sync_with_stdio(0);cin.tie(0);cout< ostream &operator<<(ostream&os,const pair&p){os< istream &operator>>(istream&is,pair&p){is>>p.first>>p.second;return is;} template ostream &operator<<(ostream&os,const vector&v){for(int i=0;i<(int)v.size();i++){os< istream &operator>>(istream&is,vector&v){for(T &in:v){is>>in;}return is;} void scan(){} template void scan(Head&head,Tail&... tail){cin>>head;scan(tail...);} template void print(const T &t){cout< void print(const Head &head, const Tail &... tail){cout< void fin(const T &... a){print(a...);exit(0);} template T sum_(vectora){return accumulate(all(a),T(0));} template inline bool chmax(T1&a,T2 b){return a inline bool chmin(T1&a,T2 b){return a>b&&(a=b,true);} /** * @brief Template(テンプレート) */ #line 1 "Math/fraction.hpp" /** * @brief Fraction(有理数型) */ struct fraction{ static long long gcd(long long a,long long b){return b?gcd(b,a%b):a;} long long num,den; fraction():num(0),den(1){} fraction(long long n):num(n),den(1){} fraction(long long n,long long d):num(n),den(d){normalize();} void normalize(){ long long g=gcd(num,den); num/=g;den/=g; if(den<0){num=-num;den=-den;} } bool operator>(const fraction &f)const{return num*f.den>den*f.num;} bool operator<(const fraction &f)const{return num*f.den=(const fraction &f)const{return num*f.den>=den*f.num;} bool operator<=(const fraction &f)const{return num*f.den<=den*f.num;} bool operator==(const fraction &f)const{return num*f.den==den*f.num;} bool operator!=(const fraction &f)const{return num*f.den!=den*f.num;} fraction operator-()const{return fraction(-num,den);} fraction &operator-=(const fraction &f){num=num*f.den-den*f.num;den*=f.den;normalize();return *this;} fraction &operator+=(const fraction &f){num=num*f.den+den*f.num;den*=f.den;normalize();return *this;} fraction &operator*=(const fraction &f){num*=f.num;den*=f.den;normalize();return *this;} fraction &operator/=(const fraction &f){num*=f.den;den*=f.num;normalize();return *this;} friend fraction operator+(const fraction&lhs,const fraction&rhs){return fraction(lhs)+=rhs;} friend fraction operator-(const fraction&lhs,const fraction&rhs){return fraction(lhs)-=rhs;} friend fraction operator*(const fraction&lhs,const fraction&rhs){return fraction(lhs)*=rhs;} friend fraction operator/(const fraction&lhs,const fraction&rhs){return fraction(lhs)/=rhs;} friend ostream& operator<<(ostream& os, const fraction& f){os<>(istream& is, fraction& f){is>>f.num>>f.den;return is;} }; #line 4 "test/yukicoder/1236.test.cpp" int main(){ string s,t; cin>>s>>t; int a=stoi(s),b=stoi(t); fraction c(a*60+b),d(720,11),x(0); while(x