Untitled
unknown
plain_text
2 years ago
1.4 kB
9
Indexable
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int levels;
int n_ary;
int m_com;
int temp;
int t2;
string t3;
string toins;
vector <int> toinsert{};
vector <int> commands{};
cin >> levels;
cin >> n_ary;
cin >> toins;
cin >> m_com;
if(0==1){
cout << "L is "<< levels<< endl;
cout << "N is "<< n_ary<< endl;
cout << "toins is "<< toins<< endl;
cout << "M is "<< m_com<< endl;
}
t2 = toins.find(",");
while(t2 != -1){
t3 = toins.substr(0, t2);
toinsert.push_back(stoi(t3));
toins = toins.substr(t2+1, toins.length());//skip the comma
//cout <<t3<<"|"<<t2<<"|"<<t4<<"|"<<toins<<"T3"<<endl;
t2 = toins.find(",");
}
toinsert.push_back(stoi(toins));
/*
//For getting all commands all at once. Will not work for milestone 3
for(int i = 0; i < m_com; i++){
cin >> temp;
commands.push_back(temp);
}
for(unsigned i = 0; i < commands.size(); i++){
continue;
cout << commands[i] << "|";
}
*/
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
return 0;
}Editor is loading...
Leave a Comment