結果
| 問題 | 
                            No.56 消費税
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-03-29 20:51:34 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 682 bytes | 
| コンパイル時間 | 12,794 ms | 
| コンパイル使用メモリ | 379,076 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 01:24:46 | 
| 合計ジャッジ時間 | 13,852 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 23 | 
ソースコード
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 tax_rate = (price * tax_rate / 100f64).floor() as i32;
    let price = price as i32;
    price  + tax_rate
}
/// 標準入力から1行取得して返します。
fn read_line() -> String {
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    input
}