結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー tnakao0123
提出日時 2016-04-09 19:54:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 974 bytes
コンパイル時間 594 ms
コンパイル使用メモリ 82,860 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 21:08:45
合計ジャッジ時間 1,722 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 356.cc: No.356 円周上を回る3つの動点の一致 - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int t1, t2, t3;
  cin >> t1 >> t2 >> t3;

  int num0 = t3 - t1, den0 = t1 * t3;
  int num1 = t3 - t2, den1 = t2 * t3;

  int g0 = __gcd(num0, den0);
  num0 /= g0, den0 /= g0;

  int g1 = __gcd(num1, den1);
  num1 /= g1, den1 /= g1;

  int gd = __gcd(den0, den1);
  ll d = (ll)den0 * den1 / gd;
  num0 *= den1 / gd;
  num1 *= den0 / gd;

  int num = __gcd(num0, num1);

  printf("%lld/%d\n", d, num);
  return 0;
}
0