結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
53,924 KB
testcase_01 WA -
testcase_02 AC 135 ms
53,968 KB
testcase_03 AC 130 ms
53,852 KB
testcase_04 AC 132 ms
54,000 KB
testcase_05 WA -
testcase_06 AC 131 ms
54,000 KB
testcase_07 AC 133 ms
53,976 KB
testcase_08 AC 136 ms
53,816 KB
testcase_09 AC 136 ms
54,128 KB
testcase_10 AC 135 ms
54,192 KB
testcase_11 AC 134 ms
54,108 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 132 ms
54,024 KB
testcase_15 AC 118 ms
52,916 KB
testcase_16 AC 133 ms
54,060 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 136 ms
54,032 KB
testcase_24 AC 137 ms
53,988 KB
testcase_25 WA -
testcase_26 AC 134 ms
54,228 KB
testcase_27 AC 134 ms
54,088 KB
testcase_28 AC 134 ms
53,800 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 133 ms
53,940 KB
testcase_32 WA -
testcase_33 AC 131 ms
53,828 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