結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー parukiparuki
提出日時 2016-06-17 14:34:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,982 ms / 5,000 ms
コード長 1,206 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 163,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 22:43:49
合計ジャッジ時間 26,731 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,601 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1,736 ms
5,376 KB
testcase_05 AC 1,942 ms
5,376 KB
testcase_06 AC 117 ms
5,376 KB
testcase_07 AC 372 ms
5,376 KB
testcase_08 AC 984 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 994 ms
5,376 KB
testcase_13 AC 1,982 ms
5,376 KB
testcase_14 AC 991 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1,968 ms
5,376 KB
testcase_17 AC 126 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 884 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 23 ms
5,376 KB
testcase_22 AC 516 ms
5,376 KB
testcase_23 AC 726 ms
5,376 KB
testcase_24 AC 72 ms
5,376 KB
testcase_25 AC 230 ms
5,376 KB
testcase_26 AC 194 ms
5,376 KB
testcase_27 AC 1,270 ms
5,376 KB
testcase_28 AC 1,285 ms
5,376 KB
testcase_29 AC 1,359 ms
5,376 KB
testcase_30 AC 169 ms
5,376 KB
testcase_31 AC 25 ms
5,376 KB
testcase_32 AC 27 ms
5,376 KB
testcase_33 AC 322 ms
5,376 KB
testcase_34 AC 891 ms
5,376 KB
testcase_35 AC 58 ms
5,376 KB
testcase_36 AC 386 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 27 ms
5,376 KB
testcase_39 AC 47 ms
5,376 KB
testcase_40 AC 3 ms
5,376 KB
testcase_41 AC 41 ms
5,376 KB
testcase_42 AC 8 ms
5,376 KB
testcase_43 AC 403 ms
5,376 KB
testcase_44 AC 70 ms
5,376 KB
testcase_45 AC 224 ms
5,376 KB
testcase_46 AC 131 ms
5,376 KB
testcase_47 AC 2 ms
5,376 KB
testcase_48 AC 2 ms
5,376 KB
testcase_49 AC 8 ms
5,376 KB
testcase_50 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

long long gcd(long long a, long long b){
    return b?gcd(b, a%b):a;
}

long long lcm(long long a, long long b){
    return a*b/gcd(a,b);
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll L, T1, T2, T3;
    while(cin >> T1 >> T2 >> T3){
        L = lcm(T1, lcm(T2, T3));
        ll x, y, z;
        x = L / T1;
        y = L / T2;
        z = L / T3;
        for(int m = (int)x; m >= 1; --m){
            ll xm = x%m, ym = y%m, zm = z%m;
            if(xm == ym&&ym == zm&&zm == xm){
                ll g = gcd(L, m);
                ll a = L / g;
                ll b = m / g;
                cout << a << '/' << b << endl;
                break;
            }
        }
    }
}
0