ACM模式JAVA的输入处理


好家伙,leetcode里用的都是BufferedReader

import java.io.*;
import  java.util.*;
public class ForInterview {

    public  static  void  main(String[] args) throws Exception{

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        String[] arr;
        String input;
        while((input=br.readLine())!=null){
            arr=input.split(" ");

            int a=Integer.parseInt(arr[0]);
            int b=Integer.parseInt(arr[1]);
            int k=a+b;
            System.out.println(k); 
        
        }

    }

}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM