题解 | 复读机

复读机

https://www.nowcoder.com/practice/9d381551b6ab40c4b5c3c8d60fe4066e

import java.util.*;
public class Main{
    public static void main(String[] args){
        String str;
        Scanner scan = new Scanner(System.in);
        int times = 4;
        while(times-->=0){
        str = scan.next();
        if(str.contains(".")){
                float temp = Float.parseFloat(str);
                System.out.printf("%.1f\n",temp);
            }
        else System.out.println(str);
        }
        scan.close();
        return;
    }
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务