結果
| 問題 |
No.56 消費税
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-03-29 20:39:25 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 24,579 ms |
| コンパイル使用メモリ | 378,092 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-11-07 01:24:16 |
| 合計ジャッジ時間 | 15,797 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 WA * 1 |
ソースコード
use std::io::stdin;
/// エントリポイント
fn main() {
let in1 = read_line();
println!("{}", tax(in1));
}
/// 消費税を加算した金額を返します。
fn tax(price_and_rate: String) -> i32 {
let sp: Vec<&str> = price_and_rate.split_whitespace().collect();
let price: f64 = sp[0].trim().parse().unwrap();
let tax_rate: f64 = sp[1].trim().parse().unwrap();
let rate = (price * (tax_rate / 100f64)).floor() as i32;
let price = price as i32;
price + rate
}
/// 標準入力から1行取得して返します。
fn read_line() -> String {
let mut input = String::new();
stdin().read_line(&mut input).unwrap();
input
}