传送门


定位:思维好题。

考虑无论如何每一个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;
}

【题解】 AGC029-A Irreversible operation的更多相关文章

  1. [Agc029A]Irreversible operation_逆序对

    Irreversible operation 题目链接:https://atcoder.jp/contests/agc029/tasks/agc029_a 数据范围:略. 题解: 假设黑色是$1$,白 ...

  2. 【AtCoder】AGC029(A-E)

    A - Irreversible operation 题解 把每个B后面的W个数累加起来即可 代码 #include <bits/stdc++.h> #define fi first #d ...

  3. 使用Oracle Data Integrator Studio创建资料档案库

    一.Creating the Database Schema /*第1步:创建临时表空间 */ create temporary tablespace user_temp tempfile 'C:\a ...

  4. Spark Streaming数据清理内幕彻底解密

    本讲从二个方面阐述: 数据清理原因和现象 数据清理代码解析 Spark Core从技术研究的角度讲 对Spark Streaming研究的彻底,没有你搞不定的Spark应用程序. Spark Stre ...

  5. LeetCode 305. Number of Islands II

    原题链接在这里:https://leetcode.com/problems/number-of-islands-ii/ 题目: A 2d grid map of m rows and n column ...

  6. POJ 2443 Set Operation 题解

    本文同时发布于 博客园 洛谷博客 题目链接 题目分析 给你n个集合,每个集合里面都有可能会重复的数字 q个询问,每次询问两个数是否会在同一集合内 $n<=1000$ $q<=200000$ ...

  7. 杭电多校HDU 6579 Operation (线性基 区间最大)题解

    题意: 强制在线,求\(LR\)区间最大子集异或和 思路: 求线性基的时候,记录一个\(pos[i]\)表示某个\(d[i]\)是在某个位置更新进入的.如果插入时\(d[i]\)的\(pos[i]\) ...

  8. Codeforces Round #177 (Div. 1) 题解【ABCD】

    Codeforces Round #177 (Div. 1) A. Polo the Penguin and Strings 题意 让你构造一个长度为n的串,且里面恰好包含k个不同字符,让你构造的字符 ...

  9. NBUT1541 Rainwater 题解

    http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1541 When rain, nocLyt discovered a magical phenomeno ...

随机推荐

  1. 小米笔记本pro CPU GPU 做科学计算的算力对比

    小米笔记本pro:15.6寸,i7-8850,16G,256G,GPU:MX150 测试对象Caffe,MNIST训练 使用纯CPU训练: 1.耗时:11分58秒 2.功耗:35W 使用GPU训练: ...

  2. Apache Sqoop 结构化、非结构化数据转换工具

    简介: Apache Sqoop 是一种用于 Apache Hadoop 与关系型数据库之间结构化.非结构化数据转换的工具. 一.安装 MySQL.导入测试数据 1.文档链接:http://www.c ...

  3. Android gralloc 模块实例

    本文实例为借鉴 http://www.ixueyi.com/jingyan/1865079.html 该文档后所写.主要是android的gralloc操作显存的模块实例,如有不正确的地方欢迎指出谢谢 ...

  4. Oracle-11g-r2 实例囚笼(Instance Caging)配置

    实例囚笼(Instance Caging)应用场合: 在单台多 CPU 的服务器上,经常出现同时运行多个数据库实例的情况,此方式有利于提高硬件的使用率. 但是多个数据库实例运行,将会互相争用服务器资源 ...

  5. 给我们的Empty Object加个图标

    Gizmos.DrawIcon (transform.position, "1.png", true);

  6. LUA Metatables

    __index:当我们访问一个表中的元素不存在时,则会触发去寻找__index元方法,如果不存在,则返回nil,如果存在,则返回结果. 博主注:__index有点像异常处理的意思 __newindex ...

  7. _MainTex_TexelSize what's the meaning?

    uniform float4 _MainTex_TexelSize where is the value of the float4 _MainTexelSize from? It's set by ...

  8. Spring Boot 集成servlet,发布为可直接运行的war包,方便后续打包为docker镜像。

    背景:Spring Boot 集成servlet,发布为可直接运行的war包,方便后续打包为docker镜像. 原文地址 https://github.com/weibaohui/springboot ...

  9. ROS Navigation中的map_server地图包功能和使用

    博客参考 http://wiki.ros.org/map_server 和 https://www.ncnynl.com/archives/201708/1897.html 1. 安装map_serv ...

  10. C++11中std::unordered_map的使用

    unordered map is an associative container that contains key-value pairs with unique keys. Search, in ...