結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー 37zigen37zigen
提出日時 2016-04-02 12:19:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 890 bytes
コンパイル時間 2,276 ms
コンパイル使用メモリ 80,288 KB
実行使用メモリ 55,496 KB
最終ジャッジ日時 2024-04-10 08:16:45
合計ジャッジ時間 12,563 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 141 ms
54,876 KB
testcase_02 AC 156 ms
54,880 KB
testcase_03 AC 139 ms
54,616 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 164 ms
55,052 KB
testcase_10 AC 160 ms
54,972 KB
testcase_11 AC 149 ms
55,252 KB
testcase_12 WA -
testcase_13 AC 800 ms
55,092 KB
testcase_14 AC 488 ms
55,180 KB
testcase_15 AC 152 ms
55,044 KB
testcase_16 WA -
testcase_17 AC 193 ms
54,928 KB
testcase_18 AC 145 ms
55,068 KB
testcase_19 WA -
testcase_20 AC 139 ms
54,988 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 176 ms
55,092 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 166 ms
54,964 KB
testcase_32 AC 167 ms
55,052 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 146 ms
55,200 KB
testcase_38 AC 166 ms
55,320 KB
testcase_39 WA -
testcase_40 AC 134 ms
54,872 KB
testcase_41 AC 167 ms
55,252 KB
testcase_42 AC 154 ms
55,024 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 144 ms
55,052 KB
testcase_48 AC 140 ms
55,016 KB
testcase_49 AC 146 ms
54,924 KB
testcase_50 AC 143 ms
55,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder356;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int t1=sc.nextInt();
		int t2=sc.nextInt();
		int t3=sc.nextInt();
		int lcm=LCM(t1,t2,t3);
		if(t1==t2&&t2==t3){
			System.out.println(0);
			return;
		}
		int[] d={lcm/t1,lcm/t2,lcm/t3};
		Arrays.sort(d);
		for(int i=d[2]-1;i>=1;i--){
			if(d[0]%i==d[1]%i&&d[1]%i==d[2]%i){
				int aaa=GCD(lcm,i);
				System.out.println(lcm/aaa+"/"+i/aaa);
				return;
			}
		}
	}
	//最小公倍数
	public static int LCM(int t1,int t2,int t3){
		return LCM(LCM(t1,t2),t3);
	}
	public static int LCM(int t1,int t2){
		int a=GCD(t1,t2);
		int tt1=t1/a;
		int tt2=t2/a;
		return tt1*tt2*a;
	}
	public static int GCD(int t1,int t2){
		if(t1<t2){
			int d=t2;
			t2=t1;
			t1=d;
		}
		if(t2==0)return t1;
		return GCD(t2,t1%t2);
	}
}
0