Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int a,x,y,z;
- string type,equals;
- int p=0,s=0;
- cin >> a;
- for (int i=0; i<a; i++) {
- cin >> x >> type >> y >> equals >> z;
- if (type=="+")
- if (x+y==z)
- s++;
- else if (type=="-")
- if (x-y==z)
- s++;
- }
- for (int i=0; i<a; i++) {
- cin >> x >> type >> y >> equals >> z;
- if (type=="+")
- if (x+y==z) {
- p++;
- //cout << " " << x << " " << type << " " << y << " " << equals << " " << z << endl;
- }
- else if (type=="-")
- if (x-y==z) {
- p++;
- //cout << " " << x << " " << type << " " << y << " " << equals << " " << z << endl;
- }
- //cout << type << endl;
- }
- cout << "Spongebob: " << s << "\nPatrick: " << p;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement