結果
問題 |
No.229 線分上を往復する3つの動点の一致
|
ユーザー |
![]() |
提出日時 | 2015-10-09 14:22:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 873 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 71,108 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-20 02:22:12 |
合計ジャッジ時間 | 1,874 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 33 |
ソースコード
#include <vector> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <functional> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <cctype> #include <string> using namespace std; typedef long long ll; /* gcdは最大公約数(greatest commond diviser) */ ll gcd(ll x, ll y) { return y == 0 ? x : gcd(y, x % y); } /* lcmは最小公倍数(least commond multiple) */ ll lcm(ll x, ll y) { return x / gcd(x, y) * y; } int main() { int t1, t2, t3; cin >> t1 >> t2 >> t3; int d = t1*t2*t3; int n = 0; int t[2] = {-1, 1}; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { int gcdt = gcd(t2*t3+t[i]*t1*t2, t1*t3+t[j]*t1*t2); if (gcdt > n) { n = gcdt; } } } int div = gcd(d, n); std::cout << d/div << "/" << n/div << std::endl; }