結果
| 問題 |
No.8022 縛りFizzBuzz (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-31 22:33:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 107 ms / 2,000 ms |
| コード長 | 1,192 bytes |
| コンパイル時間 | 3,373 ms |
| コンパイル使用メモリ | 79,168 KB |
| 実行使用メモリ | 53,980 KB |
| 最終ジャッジ日時 | 2024-07-07 04:55:35 |
| 合計ジャッジ時間 | 3,865 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 |
ソースコード
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;
public class D {
static Scanner in;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int n = ni();
int three = (int)Math.sqrt(BigInteger.TEN.intValue());
int five = BigInteger.TEN.divide(BigInteger.ONE.add(BigInteger.ONE)).intValue();
int start = BigInteger.ONE.intValue();
while(start <= n){
boolean isdt = BigInteger.valueOf(start).mod(BigInteger.valueOf(three)).equals(BigInteger.ZERO);
boolean isdf = BigInteger.valueOf(start).mod(BigInteger.valueOf(five)).equals(BigInteger.ZERO);
if(isdt && isdf){
out.println("FizzBuzz");
}else if(isdt){
out.println("Fizz");
}else if(isdf){
out.println("Buzz");
}else{
out.println(start);
}
start++;
}
}
public static void main(String[] args) throws Exception
{
in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
out = new PrintWriter(System.out);
solve();
out.flush();
}
static int ni() { return Integer.parseInt(in.next()); }
static long nl() { return Long.parseLong(in.next()); }
static double nd() { return Double.parseDouble(in.next()); }
}