結果
| 問題 |
No.229 線分上を往復する3つの動点の一致
|
| コンテスト | |
| ユーザー |
どらら
|
| 提出日時 | 2015-06-19 23:22:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,263 bytes |
| コンパイル時間 | 670 ms |
| コンパイル使用メモリ | 82,116 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-07-07 04:18:04 |
| 合計ジャッジ時間 | 7,363 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 TLE * 1 -- * 38 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
int gcd(int a, int b){return (b==0?a:gcd(b,a%b));}
int lcm(int a, int b){return a/gcd(a,b)*b;}
bool solve(ll T1, ll T2, ll T3, ll v, ll x){
double d1 = v/(double)x/(double)T1;
double d2 = v/(double)x/(double)T2;
double d3 = v/(double)x/(double)T3;
d1 -= (int)(d1);
if(d1>0.5) d1 = 1.0-d1;
d2 -= (int)(d2);
if(d2>0.5) d2 = 1.0-d2;
d3 -= (int)(d3);
if(d3>0.5) d3 = 1.0-d3;
//cout << x << " " << d1 << " " << d2 << " " << d3 << endl;
if(fabs(d1-d2)<1e-9 && fabs(d2-d3)<1e-9) return true;
return false;
}
int main(){
ll T1, T2, T3;
cin >> T1;
cin >> T2;
cin >> T3;
ll v = lcm(T1, lcm(T2, T3));
for(ll i=v-1; i>0; i--){
if(solve(T1, T2, T3, v, i)){
cout << v << "/" << i << endl;
return 0;
}
}
return 0;
}
どらら