CF5A Chat Server's Outgoing Traffic
\[\large \text{Seek the truth from facts.} \]\[\large \text{实事求是} \]\[\mathtt{\text{2023.10.22 星期六}} \]\[\text{Program Difficulty = }\color{Green}{1\quad\boxed{\underline 2}\quad3\quad4}\quad\color{Orange}{5\quad6\quad7}\quad\color{Red}{8\quad9\quad10} \]\[\text{Thinking Difficulty = }\color{Green}{\boxed{\underline 1}\quad2\quad3\quad4\quad\color{Orange}{5\quad6\quad7}\quad\color{Red}{8\quad9}\quad10} \]\[\text{Comprehensive Difficulty = }\color{Green}{1\quad2\quad\boxed{\underline 3}\quad4\quad5\quad6\quad7}\quad\color{Orange}{8\quad9\quad10\quad11\quad12\quad13\quad14}\color{Red}{\quad15\quad16\quad17\quad18\quad19\quad20} \]\[\text{Star = }\color{Green}{\boxed{\underline 1}\quad2}\color{Orange}{\quad3\quad4}\color{Red}\quad5 \]
\(\text{Problem: }\)\(\color{Black}\text{CF5A}\)\(\texttt{, 422 B}\)
简单模拟,算是CF(A题)中的水题了。
#include <iostream>
#include <string>
using namespace std;
int main(){
int ans=0,now=0;
string s;
while(getline(cin,s)){
if(s[0]=='+')now++;
else if(s[0]=='-')now--;
else{
for(int i=0;i<s.size();i++){
if(s[i]==':'){
ans+=(s.size()-i-1)*now;
}
}
}
}
cout<<ans;
return 0;
}
标签:color,text,CF5A,Orange,quad,underline
From: https://www.cnblogs.com/pr-hcx/p/17783256.html