結果

問題 No.593 4進FizzBuzz
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-28 18:43:23
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 74,012 KB
実行使用メモリ 54,224 KB
最終ジャッジ日時 2024-06-01 09:04:37
合計ジャッジ時間 12,927 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
41,140 KB
testcase_01 AC 123 ms
41,436 KB
testcase_02 AC 126 ms
41,684 KB
testcase_03 AC 115 ms
40,036 KB
testcase_04 AC 109 ms
41,364 KB
testcase_05 WA -
testcase_06 AC 122 ms
41,268 KB
testcase_07 AC 122 ms
41,160 KB
testcase_08 AC 124 ms
41,324 KB
testcase_09 AC 122 ms
41,624 KB
testcase_10 AC 122 ms
41,456 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 125 ms
41,560 KB
testcase_15 AC 122 ms
41,236 KB
testcase_16 AC 389 ms
50,172 KB
testcase_17 AC 359 ms
50,160 KB
testcase_18 AC 374 ms
50,008 KB
testcase_19 AC 407 ms
49,980 KB
testcase_20 AC 296 ms
50,140 KB
testcase_21 AC 391 ms
50,164 KB
testcase_22 AC 393 ms
49,856 KB
testcase_23 AC 340 ms
49,880 KB
testcase_24 AC 370 ms
50,248 KB
testcase_25 AC 367 ms
50,096 KB
testcase_26 AC 407 ms
50,092 KB
testcase_27 AC 412 ms
50,156 KB
testcase_28 AC 334 ms
50,216 KB
testcase_29 AC 413 ms
50,160 KB
testcase_30 AC 339 ms
50,088 KB
testcase_31 AC 397 ms
49,996 KB
testcase_32 AC 348 ms
50,080 KB
testcase_33 AC 411 ms
50,160 KB
testcase_34 AC 390 ms
49,808 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+s.charAt(i))%n;
		}
		if (temp==0) {return true;}
		return false;
	}
}
0