解题思路:
注意事项:
参考代码:
#include<stdio.h>
int main(){
int m[100],n[100],r1[100],sum=0,i=0,count=0; //count是用来检验小组测试数据用的计数器,正常程序要省略
char sign[100],equal[100];
while(scanf("%d%c%d%c%d",&m[i],&sign[i],&n[i],&equal[i],&r1[i])!=EOF && count<=2){
count++;
getchar();
if(sign[i]=='+'&&m[i]+n[i]==r1[i]&&equal[i]!='?' ||sign[i]=='-'&&m[i]-n[i]==r1[i]&&equal[i]!='?'){
sum+=1;
i++;
}
}
printf("%d",sum);
return 0;
}
0.0分
0 人评分