結果

問題 No.593 4進FizzBuzz
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-28 18:46:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 1,957 ms
コンパイル使用メモリ 71,616 KB
実行使用メモリ 65,720 KB
最終ジャッジ日時 2023-08-23 11:28:33
合計ジャッジ時間 13,356 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,456 KB
testcase_01 AC 121 ms
55,788 KB
testcase_02 AC 122 ms
55,708 KB
testcase_03 AC 120 ms
55,460 KB
testcase_04 AC 122 ms
55,404 KB
testcase_05 AC 120 ms
55,724 KB
testcase_06 AC 119 ms
55,824 KB
testcase_07 AC 119 ms
55,648 KB
testcase_08 AC 119 ms
55,712 KB
testcase_09 AC 120 ms
55,612 KB
testcase_10 AC 120 ms
55,752 KB
testcase_11 AC 121 ms
55,684 KB
testcase_12 AC 120 ms
55,444 KB
testcase_13 AC 120 ms
55,784 KB
testcase_14 AC 121 ms
55,800 KB
testcase_15 AC 120 ms
55,544 KB
testcase_16 AC 388 ms
63,084 KB
testcase_17 AC 373 ms
62,988 KB
testcase_18 AC 387 ms
63,532 KB
testcase_19 AC 419 ms
63,744 KB
testcase_20 AC 336 ms
62,996 KB
testcase_21 AC 391 ms
63,432 KB
testcase_22 AC 408 ms
63,664 KB
testcase_23 AC 330 ms
63,248 KB
testcase_24 AC 359 ms
63,176 KB
testcase_25 AC 364 ms
63,460 KB
testcase_26 AC 412 ms
63,144 KB
testcase_27 AC 418 ms
63,416 KB
testcase_28 AC 346 ms
63,312 KB
testcase_29 AC 411 ms
65,720 KB
testcase_30 AC 336 ms
63,688 KB
testcase_31 AC 392 ms
63,404 KB
testcase_32 AC 368 ms
63,292 KB
testcase_33 AC 418 ms
63,484 KB
testcase_34 AC 392 ms
63,512 KB
権限があれば一括ダウンロードができます

ソースコード

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+Character.getNumericValue(s.charAt(i)))%n;
		}
		if (temp==0) {return true;}
		return false;
	}
}
0