結果
| 問題 |
No.229 線分上を往復する3つの動点の一致
|
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2015-06-20 01:05:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,615 bytes |
| コンパイル時間 | 765 ms |
| コンパイル使用メモリ | 92,152 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-07 04:33:19 |
| 合計ジャッジ時間 | 1,825 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 8 |
ソースコード
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> P;
LL L;
LL gcd(LL a, LL b){
return (b == 0) ? a : gcd(b, a%b);
}
bool comp(P a, P b){
LL c = a.second*b.second/gcd(a.second, b.second);
a.first *= c / a.second;
b.first *= c / b.second;
return a.first < b.first;
}
P solve(LL x,LL y){
LL u = (y*L)/gcd(x, y);
return make_pair(u / gcd(u, y), y / gcd(u, y));
}
int main(void){
LL a, b, c;
cin >> a >> b >> c;
L = (a*b*c)/gcd(gcd(a,c),b);
a = L / a;
b = L / b;
c = L / c;
P res = make_pair(a*b*c, 1ll);
{auto tmp = solve(a + b, a + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(a + c, a + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(c + b, a + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(a + b, b + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(a + c, c + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(c + b, a + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - b), a + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - c), a + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(c - b), a + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - b), b + c); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - c), c + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(c - b), a + b); if (comp(tmp, res))res = tmp; }
{auto tmp = solve( a + c, abs(a - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(a + b, abs(a - c)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve( a + c, abs(c - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve( b + c, abs(a - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve( c + b, abs(a - c)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve( a + b, abs(c - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - b), abs(a - c)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - c), abs(a - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(c - b), abs(a - c)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - b), abs(b - c)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(a - c), abs(c - b)); if (comp(tmp, res))res = tmp; }
{auto tmp = solve(abs(c - b), abs(a - b)); if (comp(tmp, res))res = tmp; }
cout << res.first << "/" << res.second << endl;
return(0);
}
btk