結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 143 ms
55,024 KB
testcase_02 AC 140 ms
55,040 KB
testcase_03 AC 141 ms
54,736 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 148 ms
55,036 KB
testcase_10 AC 137 ms
54,712 KB
testcase_11 AC 134 ms
55,492 KB
testcase_12 WA -
testcase_13 AC 771 ms
55,044 KB
testcase_14 AC 441 ms
54,728 KB
testcase_15 AC 138 ms
54,800 KB
testcase_16 WA -
testcase_17 AC 185 ms
55,112 KB
testcase_18 AC 149 ms
54,776 KB
testcase_19 WA -
testcase_20 AC 148 ms
55,044 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 172 ms
55,120 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 158 ms
54,980 KB
testcase_32 AC 159 ms
54,996 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 144 ms
55,008 KB
testcase_38 AC 140 ms
54,692 KB
testcase_39 WA -
testcase_40 AC 133 ms
54,764 KB
testcase_41 AC 164 ms
55,192 KB
testcase_42 AC 149 ms
42,552 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 130 ms
42,592 KB
testcase_48 AC 145 ms
42,664 KB
testcase_49 AC 150 ms
42,696 KB
testcase_50 AC 143 ms
42,632 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