1 #include<stdio.h> 2 #include<string.h> 3 #include<algorithm> 4 #include<math.h> 5 using namespace std; 6 int main() 7 { 8 char ch,c[5]; 9 int sum=0,a,b,d; 10 while(scanf("%d%c%d=%s",&a,&ch,&b,c)!=EOF) 11 { 12 if(c[0]=='?') 13 continue; 14 if(c[2]>='0'&&c[2]<='9'&&c[1]>='0'&&c[1]<='9') 15 d=(c[0]-'0')*100+(c[1]-'0')*10+c[2]-'0'; 16 else if(c[1]>='0'&&c[1]<='9') 17 d=(c[0]-'0')*10+c[1]-'0'; 18 else 19 d=c[0]-'0'; 20 if(ch=='+'&&a+b==d) 21 sum++; 22 if(ch=='-'&&a-b==d) 23 sum++; 24 } 25 printf("%d ",sum); 26 return 0; 27 }