結果

問題 No.593 4進FizzBuzz
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-28 18:43:23
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 2,440 ms
コンパイル使用メモリ 74,372 KB
実行使用メモリ 50,364 KB
最終ジャッジ日時 2024-12-21 13:59:38
合計ジャッジ時間 13,489 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		if (div(s,15)) {out.println("FizzBuzz");}
		else if (div(s,5)) {out.println("Buzz");}
		else if (div(s,3)) {out.println("Fizz");}
		else {out.println(s);}
	}
	static boolean div (String s, int n) {
		int temp = 0;
		for (int i=0; i<s.length(); i++) {
			temp = (temp*4+s.charAt(i))%n;
		}
		if (temp==0) {return true;}
		return false;
	}
}
0