Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int a,x,y,z;
  5.     string type,equals;
  6.     int p=0,s=0;
  7.     cin >> a;
  8.     for (int i=0; i<a; i++) {
  9.         cin >> x >> type >> y >> equals >> z;
  10.         if (type=="+")
  11.             if (x+y==z)
  12.                 s++;
  13.         else if (type=="-")
  14.             if (x-y==z)
  15.                 s++;
  16.     }
  17.     for (int i=0; i<a; i++) {
  18.         cin >> x >> type >> y >> equals >> z;
  19.         if (type=="+")
  20.             if (x+y==z) {
  21.                 p++;
  22.                 //cout << " " << x << " " << type << " " << y << " " << equals << " " << z << endl;
  23.             }
  24.         else if (type=="-")
  25.             if (x-y==z) {
  26.                 p++;
  27.                 //cout << " " << x << " " << type << " " << y << " " << equals << " " << z << endl;
  28.             }
  29.         //cout << type << endl;
  30.     }
  31.     cout << "Spongebob: " << s << "\nPatrick: " << p;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement