2
5
3 4 5 2 1
5
4 4 4 2 1
is the input, where 2
is the number of test cases, 5
is "not" the size of the vector, I have to read the whole line into the vector, but only able to read one line with the code I wrote. Can you suggest better code to read the input?
int main(){
int t;
cin>>t;
while(t--){
int n;
char c;
cin>>n;
getchar();
vector<int> V;
while((c = getchar()) != '\n'){
if(atoi(&c)!=0) V.push_back(atoi(&c));
}
return 0;
}