python版本:
输入一行:
a = input() //一行输入一个字符
a, b, c = input().split() //一行输入多个字符
输入3行,每行N个字符法一:
import sys
list1 = list(map(int, sys.stdin.readline().strip().split()))
list2 = list(map(int, sys.stdin.readline().strip().split()))
list3 = list(map(int, sys.stdin.readline().strip().split()))
print(list1,list2,list3)
输入3行,每行N个字符法二:
import sys
cout = 0
for line in sys.stdin:
line = line.split()
if cout == 0:
m, n = line[0], line[1]
elif cout == 1:
list1 = list(map(int, line))
else:
list2 = list(map(int, line))
break
cout += 1
print(m, n)
print(list1, list2)
C++版本:
# include <iostream>
int a[2];
for (int i = 0; i < 2; i++) {
cin >> a[i];
/*cout << typeid(a[i]).name() << endl;*/
}
int N[10], M[10];
for (int i = 0; i < a[0]; i++) {
cin >> N[i];
}
for (int i = 0; i < a[1]; i++) {
cin >> M[i];
}
for (int i = 0; i < a[0]; i++) {
cout << N[i];
}
cout << endl;
for (int i = 0; i < a[1]; i++) {
cout << M[i];
}
for (int i = 0; i < m; i++){
cin >> M[i] ;
}