結果

問題 No.593 4進FizzBuzz
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-05 12:25:40
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 427 bytes
コンパイル時間 11,559 ms
コンパイル使用メモリ 211,240 KB
実行使用メモリ 18,516 KB
最終ジャッジ日時 2023-09-05 18:46:07
合計ジャッジ時間 56,068 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)
	d := ToDecimal593(n)
	if d%3 == 0 && d%5 == 0 {
		fmt.Println("FizzBuzz")
	} else if d%3 == 0 {
		fmt.Println("Fizz")
	} else if d%5 == 0 {
		fmt.Println("Buzz")
	} else {
		fmt.Println(n)
	}
}

func ToDecimal593(n int) int {
	var r int
	i := 0.0
	for {
		n, r, i = n/10, r+n%10*int(math.Pow(4, i)), i+1
		if n == 0 {
			return r
		}
	}
}
0