主要使用sstream,getline,get进行配合
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
int main()
{
vector<int> input_helper;
int N = 0;
cin >> N;
cin.get();//取一个换行符
int nodes = 0;
vector<vector<int>> datas;
for (int i = 0; i <= N; )
{
string s;
getline(cin,s);
stringstream scin(s);
int x = 0;
while (scin >> x)
input_helper.push_back(x);
if (input_helper.size() == 1)
{
nodes = input_helper[0];
i++;
}
else
datas.push_back(input_helper);
input_helper.clear();
}
return 0;
}