結果

問題 No.56 消費税
コンテスト
ユーザー yo-kondo
提出日時 2018-03-04 22:10:06
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
WA  
実行時間 -
コード長 485 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 18,284 ms
コンパイル使用メモリ 287,020 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-30 18:20:09
合計ジャッジ時間 20,498 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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