結果

問題 No.311 z in FizzBuzzString
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2016-01-19 19:41:27
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 371 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 77,608 KB
実行使用メモリ 62,092 KB
最終ジャッジ日時 2023-10-25 02:40:42
合計ジャッジ時間 6,022 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
61,832 KB
testcase_01 AC 126 ms
57,624 KB
testcase_02 AC 127 ms
57,564 KB
testcase_03 AC 129 ms
57,336 KB
testcase_04 AC 129 ms
57,460 KB
testcase_05 AC 126 ms
57,528 KB
testcase_06 AC 127 ms
57,564 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {

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

		long cnt = 0;
		
		for(long 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