結果

問題 No.593 4進FizzBuzz
ユーザー uafr_csuafr_cs
提出日時 2017-11-10 22:43:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 346 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 80,108 KB
実行使用メモリ 50,132 KB
最終ジャッジ日時 2024-05-03 12:56:27
合計ジャッジ時間 11,936 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
40,996 KB
testcase_01 AC 105 ms
40,144 KB
testcase_02 AC 106 ms
41,032 KB
testcase_03 AC 98 ms
40,944 KB
testcase_04 AC 106 ms
41,108 KB
testcase_05 AC 118 ms
40,852 KB
testcase_06 AC 107 ms
40,128 KB
testcase_07 AC 118 ms
41,132 KB
testcase_08 AC 108 ms
40,140 KB
testcase_09 AC 107 ms
41,108 KB
testcase_10 AC 105 ms
40,728 KB
testcase_11 AC 114 ms
40,368 KB
testcase_12 AC 108 ms
39,868 KB
testcase_13 AC 121 ms
41,212 KB
testcase_14 AC 117 ms
41,116 KB
testcase_15 AC 104 ms
39,908 KB
testcase_16 AC 303 ms
49,968 KB
testcase_17 AC 323 ms
50,024 KB
testcase_18 AC 320 ms
49,944 KB
testcase_19 AC 338 ms
50,000 KB
testcase_20 AC 304 ms
49,828 KB
testcase_21 AC 311 ms
49,912 KB
testcase_22 AC 346 ms
50,012 KB
testcase_23 AC 306 ms
49,904 KB
testcase_24 AC 318 ms
49,948 KB
testcase_25 AC 321 ms
50,108 KB
testcase_26 AC 320 ms
50,104 KB
testcase_27 AC 320 ms
50,052 KB
testcase_28 AC 324 ms
50,036 KB
testcase_29 AC 345 ms
49,968 KB
testcase_30 AC 325 ms
50,132 KB
testcase_31 AC 312 ms
49,824 KB
testcase_32 AC 327 ms
50,000 KB
testcase_33 AC 343 ms
50,040 KB
testcase_34 AC 322 ms
49,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static long MOD = 1000000007;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final String str = sc.next();
		
		long mod = 0;
		for(int i = 0; i < str.length(); i++){
			mod *= 4;
			mod %= 15;
			
			mod += Character.getNumericValue(str.charAt(i));
			mod %= 15;
		}
		
		if(mod % 15 == 0){
			System.out.println("FizzBuzz");
		}else if(mod % 5 == 0){
			System.out.println("Buzz");
		}else if(mod % 3 == 0){
			System.out.println("Fizz");
		}else{
			System.out.println(str);
		}
		
	}
}
0