【题解】 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;
}
【题解】 AGC029-A Irreversible operation的更多相关文章
- [Agc029A]Irreversible operation_逆序对
Irreversible operation 题目链接:https://atcoder.jp/contests/agc029/tasks/agc029_a 数据范围:略. 题解: 假设黑色是$1$,白 ...
- 【AtCoder】AGC029(A-E)
A - Irreversible operation 题解 把每个B后面的W个数累加起来即可 代码 #include <bits/stdc++.h> #define fi first #d ...
- 使用Oracle Data Integrator Studio创建资料档案库
一.Creating the Database Schema /*第1步:创建临时表空间 */ create temporary tablespace user_temp tempfile 'C:\a ...
- Spark Streaming数据清理内幕彻底解密
本讲从二个方面阐述: 数据清理原因和现象 数据清理代码解析 Spark Core从技术研究的角度讲 对Spark Streaming研究的彻底,没有你搞不定的Spark应用程序. Spark Stre ...
- LeetCode 305. Number of Islands II
原题链接在这里:https://leetcode.com/problems/number-of-islands-ii/ 题目: A 2d grid map of m rows and n column ...
- POJ 2443 Set Operation 题解
本文同时发布于 博客园 洛谷博客 题目链接 题目分析 给你n个集合,每个集合里面都有可能会重复的数字 q个询问,每次询问两个数是否会在同一集合内 $n<=1000$ $q<=200000$ ...
- 杭电多校HDU 6579 Operation (线性基 区间最大)题解
题意: 强制在线,求\(LR\)区间最大子集异或和 思路: 求线性基的时候,记录一个\(pos[i]\)表示某个\(d[i]\)是在某个位置更新进入的.如果插入时\(d[i]\)的\(pos[i]\) ...
- Codeforces Round #177 (Div. 1) 题解【ABCD】
Codeforces Round #177 (Div. 1) A. Polo the Penguin and Strings 题意 让你构造一个长度为n的串,且里面恰好包含k个不同字符,让你构造的字符 ...
- NBUT1541 Rainwater 题解
http://cdn.ac.nbutoj.com/Problem/view.xhtml?id=1541 When rain, nocLyt discovered a magical phenomeno ...
随机推荐
- 关于hibernate4.3版本之后org.hibernate.service.ServiceRegistryBuilder被弃用
之前一直都是使用hibernate4.2.21的我,有一天突然没有使用本地的jar包而是让IDEA自动下载最新版本的hibernate5.2.2之后,发现有几个经常使用的方法报错了. -这真是让我惊了 ...
- Yii中使用RBAC完全指南
开始准备 Yii提供了强大的配置机制和很多现成的类库.在Yii中使用RBAC是很简单的,完全不需要再写RBAC代码.所以准备工作就是,打开编辑器,跟我来.设置参数.建立数据库 在配置数组中,增加以下内 ...
- lua的注释
和C语言一样,lua也有单行注释和多行注释之分 单行注释: 采用“--”来对注释后面的字符进行注释,类似于 ISO C90之后的 C语言的注释"//" 多行注释:采用"- ...
- generator+列表生成式输出杨辉三角形
杨辉三角形: 1 1 1 1 2 1 1 3 3 1 1 4 ...
- 迷你MVVM框架 avalonjs 0.97发布
在本版本中,王之三柱臣全部就位! mmRouter: https://github.com/RubyLouvre/mmRouter mmAnimate: https://github.com/Ruby ...
- Python运维开发基础06-语法基础
上节作业回顾 (讲解+温习120分钟) #!/usr/bin/env python3 # -*- coding:utf-8 -*- # author:Mr.chen # 添加商家入口和用户入口并实现物 ...
- Ubuntu下用devstack单节点部署Openstack
一.实验环境 本实验是在Vmware Workstation下创建的单台Ubuntu服务器版系统中,利用devstack部署的Openstack Pike版. 宿主机:win10 1803 8G内存 ...
- php7源码编译安装
以下以CentOS 7.2为例,安装php的运行环境,首先打开php官网http://php.net/点击导航栏的Downloads进入下载页面:http://php.net/downloads.ph ...
- 17.Letter Combinations of a Phone Number(Back-Track)
Given a digit string, return all possible letter combinations that the number could represent. A map ...
- Castle ActiveRecord学习(七)使用日志
暂无 参考:http://terrylee.cnblogs.com/archive/2006/04/14/374829.html