結果

問題 No.311 z in FizzBuzzString
ユーザー tsunabittsunabit
提出日時 2019-05-26 20:42:15
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 586 bytes
コンパイル時間 3,560 ms
コンパイル使用メモリ 75,584 KB
実行使用メモリ 62,500 KB
最終ジャッジ日時 2023-10-25 02:58:01
合計ジャッジ時間 7,503 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
61,656 KB
testcase_01 AC 131 ms
57,576 KB
testcase_02 AC 129 ms
57,496 KB
testcase_03 AC 135 ms
57,508 KB
testcase_04 AC 135 ms
57,244 KB
testcase_05 AC 132 ms
57,608 KB
testcase_06 AC 130 ms
57,420 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;
import java.util.Collections;
import java.util.Arrays;

public class No311 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner s = new Scanner(System.in);
        long n = s.nextLong();
        int c = 0;
        for(int i = 1; i <= n; i++) {
        	if((i % 3 == 0) && (i % 5 == 0)) {
        		c += 4;
        	}else if((i % 3 == 0) || (i % 5 == 0)) {
        		c += 2;
        	}
        }
        System.out.println(c);
    }
}
0