結果

問題 No.56 消費税
ユーザー yo-kondo
提出日時 2018-03-04 22:10:06
言語 Go
(1.23.4)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 13,572 ms
コンパイル使用メモリ 235,516 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 03:34:00
合計ジャッジ時間 14,412 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	in := bufio.NewScanner(os.Stdin)
	in.Scan()
	str := in.Text()
	fmt.Println(consumptionTax(str))
}

// 消費税を加算した価格を返す。
func consumptionTax(str string) string {
	sp := strings.Split(str, " ")

	// stringをfloat64に変換する。
	price, _ := strconv.ParseFloat(sp[0], 64)
	tax, _ := strconv.ParseFloat(sp[1], 64)

	return strconv.Itoa(int(price) + int(price*(tax/100)))
}
0