結果
問題 | No.356 円周上を回る3つの動点の一致 |
ユーザー |
![]() |
提出日時 | 2016-04-02 20:04:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,837 ms / 5,000 ms |
コード長 | 904 bytes |
コンパイル時間 | 574 ms |
コンパイル使用メモリ | 73,508 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-13 21:09:23 |
合計ジャッジ時間 | 24,029 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <sstream> #include <map> #include <set> #include <queue> #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; using ll = long long; #define all(c) (c).begin(), (c).end() #define rep(i,n) for(int i=0;i<(int)(n);i++) #define pb(e) push_back(e) #define mp(a, b) make_pair(a, b) #define fr first #define sc second #define int long long const ll INF=1e9; const ll MOD=1e9+7; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; int t1,t2,t3; signed main() { cin>>t1>>t2>>t3; int lcm; lcm=t1/__gcd(t1,t2)*t2; lcm=lcm/__gcd(t3,lcm)*t3; int ans=1; rep(i,max({lcm/t1,lcm/t2,lcm/t3})+1) if(i) { if(lcm/t1%i==lcm/t2%i&&lcm/t2%i==lcm/t3%i) ans=max(ans,i); } int g=__gcd(lcm,ans); lcm/=g; ans/=g; cout<<lcm<<"/"<<ans<<endl; return 0; }