結果

問題 No.229 線分上を往復する3つの動点の一致
ユーザー machymachy
提出日時 2015-06-19 23:33:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 946 bytes
コンパイル時間 555 ms
コンパイル使用メモリ 73,876 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-21 10:17:12
合計ジャッジ時間 16,799 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 307 ms
4,376 KB
testcase_01 AC 307 ms
4,380 KB
testcase_02 AC 306 ms
4,376 KB
testcase_03 AC 307 ms
4,376 KB
testcase_04 AC 307 ms
4,376 KB
testcase_05 AC 307 ms
4,380 KB
testcase_06 AC 309 ms
4,376 KB
testcase_07 AC 307 ms
4,380 KB
testcase_08 AC 306 ms
4,376 KB
testcase_09 AC 305 ms
4,376 KB
testcase_10 AC 307 ms
4,376 KB
testcase_11 AC 306 ms
4,380 KB
testcase_12 AC 306 ms
4,380 KB
testcase_13 AC 308 ms
4,376 KB
testcase_14 AC 309 ms
4,504 KB
testcase_15 AC 305 ms
4,376 KB
testcase_16 AC 306 ms
4,376 KB
testcase_17 AC 307 ms
4,380 KB
testcase_18 AC 306 ms
4,376 KB
testcase_19 AC 307 ms
4,376 KB
testcase_20 AC 307 ms
4,380 KB
testcase_21 AC 307 ms
4,376 KB
testcase_22 AC 307 ms
4,380 KB
testcase_23 AC 309 ms
4,376 KB
testcase_24 AC 307 ms
4,376 KB
testcase_25 AC 308 ms
4,376 KB
testcase_26 AC 307 ms
4,376 KB
testcase_27 AC 306 ms
4,376 KB
testcase_28 AC 307 ms
4,380 KB
testcase_29 AC 307 ms
4,380 KB
testcase_30 AC 306 ms
4,380 KB
testcase_31 AC 313 ms
4,376 KB
testcase_32 AC 307 ms
4,376 KB
testcase_33 AC 307 ms
4,500 KB
testcase_34 AC 315 ms
4,376 KB
testcase_35 AC 315 ms
4,380 KB
testcase_36 AC 306 ms
4,376 KB
testcase_37 WA -
testcase_38 AC 307 ms
4,380 KB
testcase_39 AC 307 ms
4,380 KB
testcase_40 AC 307 ms
4,380 KB
testcase_41 AC 307 ms
4,376 KB
testcase_42 AC 307 ms
4,376 KB
testcase_43 AC 308 ms
4,380 KB
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;
typedef long long LL;

LL gcd(LL a, LL b){
    if(a > b) swap(a, b);
    if(a == 0) return b;
    return gcd(b % a, a);
}

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

int main(){
    LL t1, t2, t3;
    cin >> t1 >> t2 >> t3;
    LL m = lcm(t1, lcm(t2, t3));
    LL c1 = m / t1;
    LL c2 = m / t2;
    LL c3 = m / t3;
    LL d = 1;
    for(LL i = 1; i <= 10000000; i++){
        LL r1 = c1 - c1 / i * i;
        LL r2 = c2 - c2 / i * i;
        LL r3 = c3 - c3 / i * i;
        if((r1 == r2 || (r1*2 <= i && r1 == i-r2) || (i-r1 == r2 && r2*2 <= i))
            && (r1 == r3 || (r1*2 <= i && r1 == i-r3) || (i-r1 == r3 && r3*2 <= i))){
            d = i;
        }
    }
    if(t1 == t2 && t2 == t3){
        cout << "0/1" << endl;
    }
    cout << m << "/" << d << endl;
    return 0;
}
0