【题解】 AGC029-A Irreversible operation

传送门


定位:思维好题。

考虑无论如何每一个W都会和前面的B在一起交换一次,所以直接求和就好了。

注意long long的使用。

#include<stdio.h>
#include<string.h>
char s[200010];
long long ans,b;
int main(){
scanf("%s",s);int n=strlen(s);
for(int i=0;i<n;i++)
if(s[i]=='B')b++;
else ans+=b;
printf("%lld\n",ans);
return 0;
}
上一篇:延时显示(类QQ头像显示)


下一篇:RobotFramework自动化测试框架-移动手机自动化测试Element Attribute Should Match关键字的使用