传送门


定位:思维好题。

考虑无论如何每一个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. 基于git的管理应用程序基线包和版本

    由于工作的需要,身为git的小白的我开始研究git相关的命令和操作.结合网上收集和廖雪峰的git教程,记录所学知识点. 相关的效果就不再这里显示了. 首先我们看一下git的常用命令: 常用命令 git ...

  2. django一对一数据库建立和进行数据传输的3种方式all()(对象) values()(字典) values_list()(元组)

    class Business(models.Model): caption = models.CharField(max_length=32) code = models.CharField(max_ ...

  3. 实战zabbix3.0.2 使用percona mysql插件监控mysql5.7

    1.系统环境 [root@shard0 templates]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.2 ...

  4. 基础 ByteBuffer 和 ByteBuf

    缓冲区 ByteBuffer buffer = ByteBuffer.allocate(); ByteBuf https://www.jianshu.com/p/3fbf54b8e8ec

  5. 实用 Linux 命令行使用技巧集锦

    最近在Quora上看到一个问答题目,关于在高效率Linux用户节省时间Tips.将该题目的回答进行学习总结,加上自己的一些经验,记录如下,方便自己和大家参考. 下面介绍的都是一些命令行工具,这些工具在 ...

  6. Eclipse 安装Hibernate Tools 工具 提高开发效率

    1.打开Eclipse 开发工具  2.配置使用hibernate Tools 3.选择search 选项卡,搜索 hibernate 关键字 点击Install       Next  finish ...

  7. dsm winscp 获得 root 权限修改上传文件

    使用DSM开了ssh只可以用admin登陆scp没有权限上传文件.可以用以下方法. ssh 登陆 dsm sudo -i  取得root权限 修改 /etc/sudoers 文件中 %administ ...

  8. oracle之Sequences

    产生这样的代码,运行即可

  9. jquery中的trigger()和preventDefault()方法

    trigger()方法用户模拟用户操作,比较常见的一种情况就是输入框自动获得焦点: <!doctype html> <html> <head> <meta c ...

  10. Java设计模式(9)——观察者模式

    一.观察者模式定义 Observer模式是行为模式之一,它的作用是当一个对象的状态发生变化时,能够自动通知其他关联对象,自动刷新对象状态. Observer模式提供给关联对象一种同步通信的手段,使某个 ...