結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー itezpace
提出日時 2016-10-10 09:27:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 522 ms
コンパイル使用メモリ 64,704 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 00:47:53
合計ジャッジ時間 1,766 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){
  if(b!=0){
    return gcd(b,a%b);
  } else {
    return a;
  }
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}
int main(){
  ll T1=0,T2=0,T3=0;cin>>T1>>T2>>T3;
  ll x=lcm(T1,lcm(T2,T3));
  vector<ll> v(3);
  v[0]=x/T1;
  v[1]=x/T2;
  v[2]=x/T3;
  sort(v.begin(),v.end());
  ll a=v[1]-v[0];
  ll b=v[2]-v[1];
  ll y=gcd(a,b);
  cout<<x<<"/"<<y<<endl;
}
0