結果
問題 |
No.356 円周上を回る3つの動点の一致
|
ユーザー |
![]() |
提出日時 | 2016-04-01 23:19:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,239 bytes |
コンパイル時間 | 787 ms |
コンパイル使用メモリ | 85,312 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-23 02:38:42 |
合計ジャッジ時間 | 2,129 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 WA * 2 |
ソースコード
#include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> //#include<cctype> #include<climits> #include<iostream> #include<string> #include<vector> #include<map> //#include<list> #include<queue> #include<deque> #include<algorithm> //#include<numeric> #include<utility> #include<complex> //#include<memory> #include<functional> #include<cassert> #include<set> #include<stack> const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; pair<ll, ll> calc(ll x, ll y) { ll z = y-x; ll w = x*y; ll g = __gcd(z, w); return make_pair(z/g, w/g); } int main() { cin.tie(0); ios::sync_with_stdio(false); vector<ll> T(3); for (int i = 0; i < 3; i++) cin >> T[i]; auto x = calc(T[0], T[1]); auto y = calc(T[0], T[2]); swap(x.first, x.second); swap(y.first, y.second); pair<ll, ll> z = make_pair(x.first*y.second, x.second*y.second); pair<ll, ll> w = make_pair(y.first*x.second, y.second*x.second); ll lcm = z.first/__gcd(z.first, w.first) * w.first; ll gcd = __gcd(lcm, z.second); cout << lcm/gcd << "/" << z.second/gcd << endl; return 0; }