题解 | #学生基本信息输入输出#
学生基本信息输入输出
https://www.nowcoder.com/practice/58b6a69b4bf943b49d2cd3c15770b9fd
use std::io::{self}; fn main() { let mut a = String::new(); io::stdin().read_line(&mut a).expect("读取错误"); let a:Vec<_> = a.trim().split(";").collect(); let c = a[1]; let c:Vec<_> =c.split(',').collect(); let mut arry = Vec::new(); for i in c.iter() { let e:f64 = i.parse().unwrap(); arry.push( (e * 100.0).round() / 100.0); } println!("The each subject score of No. {} is {:.2}, {:.2}, {:.2}.",a[0],arry[0],arry[1],arry[2]); }