結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー kou6839kou6839
提出日時 2015-12-09 16:01:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 461 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 72,400 KB
実行使用メモリ 56,216 KB
最終ジャッジ日時 2023-08-13 15:44:26
合計ジャッジ時間 7,853 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,092 KB
testcase_01 AC 119 ms
55,380 KB
testcase_02 AC 118 ms
56,148 KB
testcase_03 AC 119 ms
55,916 KB
testcase_04 AC 119 ms
55,592 KB
testcase_05 AC 118 ms
55,416 KB
testcase_06 AC 119 ms
56,016 KB
testcase_07 AC 118 ms
55,836 KB
testcase_08 AC 118 ms
55,944 KB
testcase_09 AC 119 ms
56,008 KB
testcase_10 AC 120 ms
56,104 KB
testcase_11 AC 120 ms
55,740 KB
testcase_12 AC 119 ms
55,512 KB
testcase_13 AC 119 ms
56,132 KB
testcase_14 AC 117 ms
55,480 KB
testcase_15 AC 119 ms
55,484 KB
testcase_16 AC 118 ms
55,436 KB
testcase_17 AC 118 ms
55,656 KB
testcase_18 AC 118 ms
55,748 KB
testcase_19 AC 119 ms
55,652 KB
testcase_20 AC 123 ms
56,024 KB
testcase_21 AC 121 ms
56,116 KB
testcase_22 AC 120 ms
55,552 KB
testcase_23 AC 119 ms
55,952 KB
testcase_24 AC 122 ms
55,904 KB
testcase_25 AC 120 ms
55,488 KB
testcase_26 AC 120 ms
56,056 KB
testcase_27 AC 120 ms
55,680 KB
testcase_28 AC 121 ms
55,416 KB
testcase_29 AC 121 ms
55,752 KB
testcase_30 AC 121 ms
55,656 KB
testcase_31 AC 120 ms
56,112 KB
testcase_32 AC 120 ms
55,740 KB
testcase_33 AC 120 ms
55,960 KB
testcase_34 AC 122 ms
56,216 KB
testcase_35 AC 123 ms
55,928 KB
testcase_36 AC 120 ms
55,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static long gcd(long a,long b){
		return b == 0 ? a : gcd(b, a%b);
	}
	static long lcm(long a, long b){
		return a*b/gcd(a, b);
	}
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		long n = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		System.out.println(n/a+n/b+n/c-n/lcm(a, b)-n/lcm(b, c)-n/lcm(c, a)+n/lcm(a, lcm(b, c)));
	}
}
0