【题解】 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 ...
随机推荐
- 36. Valid Sudoku + 37. Sudoku Solver
▶ 有关数独的两个问题. ▶ 36. 检测当前盘面是否有矛盾(同一行.同一列或 3 × 3 的小框内数字重复),而不关心该盘面是否有解. ● 初版代码,24 ms,没有将格子检测函数独立出去,行检测. ...
- 我的第一个C程序
// // main.c // one // // Created by Shuang Gai on 2019/1/19. // Copyright © 2019 Shuang Gai. All ri ...
- 基础 ByteBuffer 和 ByteBuf
缓冲区 ByteBuffer buffer = ByteBuffer.allocate(); ByteBuf https://www.jianshu.com/p/3fbf54b8e8ec
- C++ 获取特定进程的CPU使用率<转>
C++ 获取特定进程的CPU使用率 近来发现笔记本在关闭屏幕后风扇转得特别快,打开屏幕后看任务管理器,风扇马上减速,也没有发现大量占用CPU的进程.于是想写一个小程序在后台记录每个进程的CPU使用情况 ...
- $in 操作符
[$in 操作符] The $in operator selects the documents where the value of a field equals any value in the ...
- 24.Swap Nodes in Pairs (List; Two-Pointers)
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ...
- 网页截图API接口,一键自动生成网页截图
背景 最近在开发一个小程序,其中有一个帮助模块,内容为帮助文章列表,文章内容为网站后台编辑的富文本格式.鉴于小程序的特殊性,其对html格式的富文本支持并不友好. 刚开始有人开发了wxparse插件, ...
- 转载《Spring AOP中pointcut expression表达式解析 及匹配多个条件》
原文地址:https://www.cnblogs.com/rainy-shurun/p/5195439.html 原文 Pointcut 是指那些方法需要被执行"AOP",是由&q ...
- requests.session之set trust_env to disable environment searches for proxies
import requests s = requests.Session() s.trust_env = False This will prevent requests getting any in ...
- catkin
catkin ros https://github.com/dirkholz/pcl_online_viewer rosrun ???