题解 | #学生基本信息输入输出#

学生基本信息输入输出

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]);

    
    

}

全部评论

相关推荐

黑皮白袜臭脚体育生:春节刚过就开卷吗?哈基馆,你这家伙......
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务