結果

問題 No.311 z in FizzBuzzString
ユーザー kenji_shioya
提出日時 2016-05-30 22:47:59
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 420 bytes
コンパイル時間 3,465 ms
コンパイル使用メモリ 74,108 KB
実行使用メモリ 54,476 KB
最終ジャッジ日時 2024-09-24 21:42:31
合計ジャッジ時間 5,608 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise37{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int num = sc.nextInt();
    int count = 0;

    for (int n = 1; n <= num; n++){
      if (n % 3 == 0 && n % 5 == 0){
        count += 4;
      }else if(n % 3 == 0){
        count += 2;
      }else if(n % 5 == 0){
        count += 2;
      }
    }

    System.out.println(count);
  }
}
0