提交时间:2025-02-01 15:51:28
运行 ID: 5301
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a,b; char j,d; string C; int temp = 0; for(int i = 0;i < n;i++) { cin>>a>>j>>b>>d; cin>>C; if(C[0] != '?') { int c = 0; if(sizeof(C) == 3) { c = (C[0] - '0') * 100; c = (C[1] - '0') * 10; c = (C[2] - '0') * 1; } else if(sizeof(C) == 2) { c = (C[0] - '0') * 10; c = (C[1] - '0') * 1; } else { c = (C[0] - '0') * 1; } if(j == '+' && a + b == c) { temp++; } else if(j == '-' && a - b == c) { temp++; } } } cout<<temp; return 0; }