結果

問題 No.311 z in FizzBuzzString
ユーザー h_tyokinuhata
提出日時 2016-01-19 19:17:46
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 367 bytes
コンパイル時間 2,312 ms
コンパイル使用メモリ 74,736 KB
実行使用メモリ 54,308 KB
最終ジャッジ日時 2024-09-24 21:31:58
合計ジャッジ時間 4,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();

		int cnt = 0;
		
		for(int i = 1; i <= N; i++) {
			if(i % 3 == 0 && i% 5 == 0) {
				cnt+=4;
			} else if(i % 3 == 0) {
				cnt+=2;
			} else if(i % 5 == 0) {
				cnt+=2;
			}
		}
		
		System.out.println(cnt);
	}
}
0