Day6.(每日一题)A. Chat Server‘s Outgoing Traffic(C语言)
作者:互联网
#include <stdio.h>
#include <string.h>
int main()
{
char s[101];
int cnt=0,sum=0;
while(gets(s))
{
if(s[0]=='+')
cnt++;
else if(s[0]=='-')
cnt--;
else
{
int i=0;
while(s[i]!=':')
i++;
sum+=(strlen(s)-i-1)*cnt;
}
memset(s,0,sizeof(s));
}
printf("%d\n",sum);
return 0;
}
标签:Outgoing,include,Day6,++,sum,cnt,Server,int,else 来源: https://blog.csdn.net/qq_61953860/article/details/122388037