啊这为什么过不了?
查看原帖
啊这为什么过不了?
366547
CY666楼主2020/11/29 23:45
#include<bits/stdc++.h>
using namespace std;
string s;
int t,ans;
int main()
{
	while(getline(cin,s))
	{
		if(s[0]=='+')
		{
			t++;
		}
		else if(s[0]=='-')
		{
			t--;
		}
		else
		{
			int i=s.find(':');
			ans=ans+t*(s.size()+1-i);		
		}
	 } 
	 cout<<ans<<endl;
	 return 0;
}
2020/11/29 23:45
加载中...