結果

問題 No.229 線分上を往復する3つの動点の一致
ユーザー GrenacheGrenache
提出日時 2015-06-20 11:57:58
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,024 bytes
コンパイル時間 4,170 ms
コンパイル使用メモリ 74,044 KB
実行使用メモリ 60,852 KB
最終ジャッジ日時 2023-09-21 21:58:55
合計ジャッジ時間 12,844 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
56,376 KB
testcase_01 AC 144 ms
56,664 KB
testcase_02 AC 144 ms
56,952 KB
testcase_03 AC 145 ms
56,840 KB
testcase_04 AC 145 ms
56,716 KB
testcase_05 AC 145 ms
57,032 KB
testcase_06 WA -
testcase_07 AC 146 ms
56,832 KB
testcase_08 AC 150 ms
56,728 KB
testcase_09 AC 146 ms
56,872 KB
testcase_10 AC 146 ms
56,936 KB
testcase_11 AC 144 ms
56,420 KB
testcase_12 AC 143 ms
56,856 KB
testcase_13 WA -
testcase_14 AC 144 ms
55,212 KB
testcase_15 AC 144 ms
56,744 KB
testcase_16 WA -
testcase_17 AC 145 ms
58,476 KB
testcase_18 AC 145 ms
56,840 KB
testcase_19 AC 144 ms
57,420 KB
testcase_20 AC 148 ms
56,672 KB
testcase_21 WA -
testcase_22 AC 145 ms
56,424 KB
testcase_23 AC 144 ms
56,564 KB
testcase_24 AC 145 ms
56,636 KB
testcase_25 AC 147 ms
56,964 KB
testcase_26 AC 147 ms
56,724 KB
testcase_27 AC 146 ms
56,884 KB
testcase_28 AC 146 ms
56,832 KB
testcase_29 AC 146 ms
56,768 KB
testcase_30 WA -
testcase_31 AC 146 ms
57,024 KB
testcase_32 WA -
testcase_33 AC 143 ms
56,840 KB
testcase_34 AC 144 ms
56,772 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 143 ms
56,836 KB
testcase_39 AC 143 ms
56,804 KB
testcase_40 WA -
testcase_41 AC 144 ms
56,568 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder229 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long t1 = sc.nextLong();
        long t2 = sc.nextLong();
        long t3 = sc.nextLong();

        long lcm = lcm(t1, lcm(t2, t3));

        long max = 1;
        max = Math.max(max, gcd(gcd(Math.abs(t2 - t1), Math.abs(t3 - t2)), Math.abs(t1 - t3)));
        max = Math.max(max, gcd(gcd(Math.abs(t2 - t1), Math.abs(t3 + t2)), Math.abs(t1 + t3)));
        max = Math.max(max, gcd(gcd(Math.abs(t3 - t2), Math.abs(t1 + t3)), Math.abs(t2 + t1)));
        max = Math.max(max, gcd(gcd(Math.abs(t1 - t3), Math.abs(t2 + t1)), Math.abs(t3 + t2)));

        long gcd = gcd(lcm, max);
        System.out.println(lcm / gcd + "/" + max / gcd);
        
        sc.close();
    }

    private static long lcm(long n, long m) {
		return n * m / gcd(n, m);
	}

	private static long gcd(long n, long m) {
		if (m == 0) {
			return n;
		} else {
			return gcd(m, n % m);
		}
	}
}
0