結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー jp_ste
提出日時 2016-02-17 02:00:43
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 509 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 526,720 KB
最終ジャッジ日時 2024-09-22 07:24:19
合計ジャッジ時間 11,472 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 RE * 9 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		boolean flag[] = new boolean[N+1];
		int check[] = { a,b,c };
		for(int i=0; i<3; i++) {
			for(int j=check[i]; j<=N; j+=check[i]) {
				flag[j] = true;
			}
		}
		
		int count = 0;
		for(int i=1; i<=N; i++) {
			if(flag[i]) count++;
		}
		System.out.println(count);
	}
}
0