--- title: ACM 输入输出语句 comments: true toc: true permalink: posts/acm-io/ date: 2018-07-31 13:52:17 updated: 2019-07-22 18:48:00 categories: - ACM tags: - ACM - OJ --- 一些自己用的输入输出语句。 ## Python 输入 ### 输入一行由空格切分的值 ```python # py2 w = raw_input().split() # py3 w = input().split() ``` ### 输入整形变量 ```python # py2 w = map(int,raw_input().split()) # py3 w = map(int,input().split()) ``` ## JAVA 中在 OJ 上怎么实现多组输入 ```java import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { double a = sc.nextDouble(); // DO } } } ``` ## C 多组输入 ```c int a, b; while(scanf("%d%d", &a, &b) != EOF) { } ``` ## C++中在 OJ 上怎么实现多组输入 ```cpp while(cin >> a >> b){ } ```