結果
問題 | No.356 円周上を回る3つの動点の一致 |
ユーザー |
![]() |
提出日時 | 2016-04-02 00:09:44 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,121 bytes |
コンパイル時間 | 1,179 ms |
コンパイル使用メモリ | 157,984 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 21:03:56 |
合計ジャッジ時間 | 2,682 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef complex<double> P; typedef pair<int,int> pii; #define REP(i,n) for(ll i=0;i<n;++i) #define REPR(i,n) for(ll i=1;i<n;++i) #define FOR(i,a,b) for(ll i=a;i<b;++i) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl #define ALL(a) (a).begin(),(a).end() #define MOD (ll)(1e9+7) #define ADD(a,b) a=((a)+(b))%MOD #define FIX(a) ((a)%MOD+MOD)%MOD struct Ratio{ ll up,down; }; void yakubun(Ratio &r){ ll g = __gcd(r.up,r.down); r.up /= g; r.down /= g; } void osae(Ratio &r){ r.up %= r.down; } int main(){ int t1,t2,t3; cin>>t1>>t2>>t3; Ratio p = {t1,t2-t1}; yakubun(p); Ratio p2 = p; p2.up *= t2; p2.down *= t3; yakubun(p2); ll N; // n t1 t3 = n t1 t2 { ll x = t1 * (t3-t2); ll y = t3 * (t2-t1); if(x % y == 0){ N = 1; }else{ ll g = __gcd(x,y); N = y/g; } } Ratio ans = {N*t1*t2, t2-t1}; yakubun(ans); printf("%lld/%lld\n",ans.up,ans.down); return 0; }