結果

問題 No.356 円周上を回る3つの動点の一致
ユーザー 37zigen37zigen
提出日時 2016-04-02 12:31:24
言語 Java21
(openjdk 21)
結果
AC  
実行時間 2,290 ms / 5,000 ms
コード長 911 bytes
コンパイル時間 2,668 ms
コンパイル使用メモリ 79,712 KB
実行使用メモリ 42,724 KB
最終ジャッジ日時 2024-04-21 22:47:02
合計ジャッジ時間 39,474 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,868 ms
42,452 KB
testcase_01 AC 182 ms
42,640 KB
testcase_02 AC 180 ms
42,648 KB
testcase_03 AC 181 ms
42,356 KB
testcase_04 AC 2,027 ms
42,624 KB
testcase_05 AC 2,234 ms
42,356 KB
testcase_06 AC 313 ms
42,424 KB
testcase_07 AC 583 ms
42,564 KB
testcase_08 AC 1,230 ms
42,636 KB
testcase_09 AC 183 ms
42,276 KB
testcase_10 AC 182 ms
42,240 KB
testcase_11 AC 179 ms
42,248 KB
testcase_12 AC 1,241 ms
42,584 KB
testcase_13 AC 2,290 ms
42,676 KB
testcase_14 AC 1,234 ms
42,244 KB
testcase_15 AC 186 ms
42,240 KB
testcase_16 AC 2,282 ms
42,140 KB
testcase_17 AC 326 ms
42,348 KB
testcase_18 AC 186 ms
42,432 KB
testcase_19 AC 1,124 ms
42,408 KB
testcase_20 AC 186 ms
42,580 KB
testcase_21 AC 217 ms
42,484 KB
testcase_22 AC 738 ms
42,548 KB
testcase_23 AC 949 ms
42,276 KB
testcase_24 AC 266 ms
42,676 KB
testcase_25 AC 417 ms
42,496 KB
testcase_26 AC 394 ms
42,292 KB
testcase_27 AC 1,515 ms
42,484 KB
testcase_28 AC 1,548 ms
42,604 KB
testcase_29 AC 1,620 ms
42,668 KB
testcase_30 AC 368 ms
42,564 KB
testcase_31 AC 225 ms
42,356 KB
testcase_32 AC 223 ms
42,280 KB
testcase_33 AC 538 ms
42,448 KB
testcase_34 AC 1,150 ms
42,424 KB
testcase_35 AC 260 ms
42,280 KB
testcase_36 AC 605 ms
42,584 KB
testcase_37 AC 185 ms
42,336 KB
testcase_38 AC 215 ms
42,536 KB
testcase_39 AC 236 ms
42,436 KB
testcase_40 AC 188 ms
42,480 KB
testcase_41 AC 230 ms
42,304 KB
testcase_42 AC 190 ms
42,640 KB
testcase_43 AC 610 ms
42,724 KB
testcase_44 AC 262 ms
42,264 KB
testcase_45 AC 437 ms
42,536 KB
testcase_46 AC 335 ms
42,424 KB
testcase_47 AC 182 ms
42,432 KB
testcase_48 AC 185 ms
42,544 KB
testcase_49 AC 197 ms
42,212 KB
testcase_50 AC 188 ms
42,548 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);
		long t1=sc.nextInt();
		long t2=sc.nextInt();
		long t3=sc.nextInt();
		long lcm=LCM(t1,t2,t3);
		if(t1==t2&&t2==t3){
			System.out.println(0);
			return;
		}
		long[] d={lcm/t1,lcm/t2,lcm/t3};
		Arrays.sort(d);
		for(long i=d[2]-1;i>=1;i--){
			if(d[0]%i==d[1]%i&&d[1]%i==d[2]%i){
				long aaa=GCD(lcm,i);
				System.out.println(lcm/aaa+"/"+i/aaa);
				return;
			}
		}
	}
	//最小公倍数
	public static long LCM(long t1,long t2,long t3){
		return LCM(LCM(t1,t2),t3);
	}
	public static long LCM(long t1,long t2){
		long a=GCD(t1,t2);
		long tt1=t1/a;
		long tt2=t2/a;
		return tt1*tt2*a;
	}
	public static long GCD(long t1,long t2){
		if(t1<t2){
			long d=t2;
			t2=t1;
			t1=d;
		}
		if(t2==0)return t1;
		return GCD(t2,t1%t2);
	}
}
0