用String字符串收集原始数据,然后遍历string,遇到"."则进行相应处理
判断其后是否有数据且数据是否大于'5' 然后输出相应数据

import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '.') {
                if (i + 1 < str.length()) {
                    char ch = str.charAt(i + 1);
                    if (ch >= '5') {
                        System.out.println(Integer.parseInt(str.substring(0, i)) + 1);
                    } else {
                        System.out.println(Integer.parseInt(str.substring(0, i)));
                    }
                    break;
                }
            }
        }
    }       
}