結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-21 00:01:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 570 bytes
コンパイル時間 2,190 ms
コンパイル使用メモリ 74,616 KB
実行使用メモリ 54,468 KB
最終ジャッジ日時 2024-04-29 20:02:46
合計ジャッジ時間 8,614 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,124 KB
testcase_01 WA -
testcase_02 AC 135 ms
41,160 KB
testcase_03 AC 118 ms
39,956 KB
testcase_04 AC 133 ms
41,124 KB
testcase_05 WA -
testcase_06 AC 137 ms
41,364 KB
testcase_07 AC 123 ms
40,076 KB
testcase_08 AC 133 ms
41,368 KB
testcase_09 AC 133 ms
41,168 KB
testcase_10 AC 131 ms
41,400 KB
testcase_11 AC 134 ms
41,416 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 132 ms
41,036 KB
testcase_15 AC 133 ms
41,600 KB
testcase_16 AC 135 ms
41,116 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 130 ms
41,296 KB
testcase_24 AC 132 ms
41,092 KB
testcase_25 WA -
testcase_26 AC 136 ms
41,424 KB
testcase_27 AC 134 ms
41,400 KB
testcase_28 AC 130 ms
41,576 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 137 ms
41,324 KB
testcase_32 WA -
testcase_33 AC 135 ms
41,424 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
		int a=scanner.nextInt();
		int b=scanner.nextInt();
		int c=scanner.nextInt();
		long ab=n/(a*b);
		long ac=n/(a*c);
		long bc=n/(b*c);
		long abc=n/(a*b*c);
		long na=n/a;
		long nb=n/b;
		long nc=n/c;
		if(b%a==0){
			ab=0;
			bc=0;
			abc=0;
			nb=0;
		}
		if(c%a==0||c%b==0){
			ac=0;
			bc=0;
			abc=0;
			nc=0;
		}
		System.out.println(na+nb+nc-(ab+ac+bc-abc));
		
	}
}
0