結果

問題 No.311 z in FizzBuzzString
ユーザー GchansanjouGchansanjou
提出日時 2018-02-23 21:47:04
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 787 bytes
コンパイル時間 3,049 ms
コンパイル使用メモリ 74,292 KB
実行使用メモリ 59,092 KB
最終ジャッジ日時 2023-10-25 02:53:28
合計ジャッジ時間 6,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
57,696 KB
testcase_01 AC 51 ms
53,324 KB
testcase_02 AC 52 ms
53,328 KB
testcase_03 AC 51 ms
53,324 KB
testcase_04 AC 51 ms
53,324 KB
testcase_05 AC 52 ms
53,316 KB
testcase_06 AC 52 ms
53,328 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukiCoder;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No00311 {

	public static void main(String[] args) {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		try {
			long length = Long.parseLong(bufferedReader.readLine());
			long ans = 0;
			for(long i = 1 ; i <= length ; i++) {
				if(i % 3 == 0 && i % 5 ==0) {
					ans+=4;
				}else if(i % 3 == 0) {
					ans+=2;
				}else if(i % 5 ==0) {
					ans+=2;
				}
			}
			System.out.println(ans);
		} catch (NumberFormatException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
	}

}
0