java解决 acm题中的读取整数问题

来源:互联网 发布:钢琴谱曲软件 编辑:程序博客网 时间:2024/06/09 21:17

<!--@page { margin: 0.79in }PRE.cjk { font-family: "DejaVu Sans", monospace }P { margin-bottom: 0.08in }-->

java
解决acm 中整数的 读取  input12 23 34 23output12 233423

 

import java.io.IOException;
import java.io.InputStreamReader;

public class test{
public static void main(String[] args) throws IOException{
// 创建输入流对象
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// 读取一行信息
String input = reader.readLine();
// 以空格为分隔符,转换成数组
String[] numbers = input.split(" ");
for(int j=0;j<numbers.length;j++)
{
System.out.print(Integer.parseInt(numbers[j]));
}

}
}