結果

問題 No.311 z in FizzBuzzString
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2016-01-19 19:17:46
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 367 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 77,352 KB
実行使用メモリ 58,000 KB
最終ジャッジ日時 2023-10-25 02:40:35
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
57,524 KB
testcase_01 AC 127 ms
57,488 KB
testcase_02 AC 127 ms
57,452 KB
testcase_03 AC 127 ms
57,484 KB
testcase_04 AC 126 ms
57,524 KB
testcase_05 AC 130 ms
57,504 KB
testcase_06 AC 127 ms
57,464 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
権限があれば一括ダウンロードができます

ソースコード

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