Skip to content

Instantly share code, notes, and snippets.

@sifue
Created July 7, 2016 08:06
Show Gist options
  • Select an option

  • Save sifue/a6ff0ae1d112a2dd37423ca7b2ea374e to your computer and use it in GitHub Desktop.

Select an option

Save sifue/a6ff0ae1d112a2dd37423ca7b2ea374e to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
vector<string> split(const string &s, char delim) {
vector<string> elems;
stringstream ss(s);
string item;
while (getline(ss, item, delim)) {
if (!item.empty()) {
elems.push_back(item);
}
}
return elems;
}
int main() {
string str;
getline(cin, str);
vector<string> splited = split(str, ' ');
int desk = stoi(splited[0].c_str());
int chair = stoi(splited[1].c_str());
cout << desk * chair << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment