哈哈


私信TA

用户名:ygb

访问量:4099

签 名:

I need a team.

等  级
排  名 4723
经  验 1583
参赛次数 0
文章发表 5
年  龄 20
在职情况 学生
学  校 山东省*****
专  业 软件工程(大二)

  自我简介:

我嘛,嗯......

运行超时,求大神指点。


#include<stdio.h>

#include<string.h>

#include<stdlib.h>

int main()

{

int a1,a2,r=0;

char c1,c2,c3[10];

scanf("%d",&a1);

while(a1!=EOF)

{

scanf("%c",&c1);

scanf("%d",&a2);

scanf("%c",&c2);

scanf("%s",c3);

if(strcmp(c3,"?"))

{

if(c1=='+')

{

if(a1+a2==atoi(c3))

{

r++;

}

}

else if(c1=='-')

{

if(a1-a2==atoi(c3))

{

r++;

}

}

scanf("%d",&a1);

}

}

printf("%d\n",r);

return 0;

}


 

0.0分

0 人评分

  评论区