Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. cin.ignore();
  10. for (int i = 0; i < n; i++) {
  11. string inp;
  12. getline(cin, inp);
  13. if (inp == "P=NP") {
  14. cout << "skipped\n";
  15. }
  16. else {
  17. int index = inp.find("+");
  18. int first = stoi(inp.substr(0, index));
  19. int second = stoi(inp.substr(index + 1));
  20. cout << first + second << endl;
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement