读取不定行数的输入
python
import sys
InputList=sys.stdin.readlines()
print(InputList)
说明:在输入完后,单独另起一行输入CTRL+z,回车
c++
#include<bits/stdc++.h>
using namespace std;
int h[50001];int i=0;
int main()
{
while(cin>>h[i++]);
cout<<h[2]<<endl;
return 0;
}
python
import sys
InputList=sys.stdin.readlines()
print(InputList)
c++
#include<bits/stdc++.h>
using namespace std;
int h[50001];int i=0;
int main()
{
while(cin>>h[i++]);
cout<<h[2]<<endl;
return 0;
}