結果

問題 No.1236 長針と短針
ユーザー MtSakaMtSaka
提出日時 2021-12-25 08:44:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,923 bytes
コンパイル時間 2,076 ms
コンパイル使用メモリ 202,304 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 10:13:55
合計ジャッジ時間 2,889 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~

ソースコード

diff #

#pragma once
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vl=vector<ll>;
using vi=vector<int>;
using vs=vector<string>;
using vc=vector<char>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using vvc=vector<vc>;
using vd=vector<double>;
using vp=vector<P>;
using vb=vector<bool>;
#define overload4(_1,_2,_3,_4,name,...) name
#define overload3(_1,_2,_3,name,...) name
#define rep1(a) for(__typeof(a) i=0;i<a;i++)
#define rep2(i,a) for(__typeof(a) i=0;i<a;i++)
#define rep3(i,a,b) for(__typeof(a) i=a;i<b;i++)
#define rep4(i,a,b,c) for(__typeof(a) i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(a) for(__typeof(a) i=(a)-1;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<<fixed<<setprecision(12)
#define max_(a) *max_element(all(a))
#define min_(a) *min_element(all(a))
#define INT(...) int __VA_ARGS__;scan(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;scan(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;scan(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;scan(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;scan(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;scan(__VA_ARGS__)
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const ll inf=2e18;
const ll MOD=1000000007;
const ll mod=998244353;
const double pi=acos(-1);
template<typename T1,typename T2 >
ostream &operator<<(ostream&os,const pair<T1,T2>&p){os<<p.first<<" "<<p.second;return os;}
template<typename T1,typename T2>
istream &operator>>(istream&is,pair<T1,T2>&p){is>>p.first>>p.second;return is;}
template<typename T>
ostream &operator<<(ostream&os,const vector<T>&v){for(int i=0;i<(int)v.size();i++){os<<v[i]<<(i+1!=v.size()?" ":"");}return os;}
template<typename T>
istream &operator>>(istream&is,vector<T>&v){for(T &in:v){is>>in;}return is;}
void scan(){}
template<class Head,class... Tail>
void scan(Head&head,Tail&... tail){cin>>head;scan(tail...);}
template<class T>
void print(const T &t){cout<<t<<'\n';}
template<class Head, class... Tail>
void print(const Head &head, const Tail &... tail){cout<<head<<' ';print(tail...);}
template<class... T>
void fin(const T &... a){print(a...);exit(0);}
template<typename T>
T sum_(vector<T>a){return accumulate(all(a),T(0));}
template<typename T1,typename T2>
inline bool chmax(T1&a,T2 b){return a<b&&(a=b,true);}
template<typename T1,typename T2>
inline bool chmin(T1&a,T2 b){return a>b&&(a=b,true);}
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<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;}
  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<<f.num<<"/"<<f.den;return os;}
  friend istream& operator>>(istream& is, fraction& f){is>>f.num>>f.den;return is;}
};
int main(){
  string s,t;
  cin>>s>>t;
  int a=stoi(s),b=stoi(t);
  fraction c(a*60+b),d(720,11),x;
  cerr<<x<<endl;
  while(x<c){
      x+=d;
      cerr<<x<<endl;
  }
  x=x-c;
  cerr<<x<<" "<<c<<endl;
  cout<<x.num*60/x.den<<endl;
}
0