CodeForces 591B】的更多相关文章

题目链接: http://codeforces.com/problemset/problem/591/B 题意: 给你一串字符串,字符串里的字符全是a-z的小写字母,下面的m行,是字符串的交换方式, 如果输入的是 x  y,则是字母x与字母y交换,且字母y与字母x也要交换 解题思路: n和m的范围在2*10^5内,如果直接暴力肯定会超时: 所以只能采取智慧的方法 可以先定义 char a[26]={'a','b','c','d','e','f','g','h','i','j','k','l','…
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding - an active marketing strategy, that includes a set of measures to change either the bra…
水题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<algorithm> using namespace std; vector<]; int n,m; +],ans[+]; ]; ],t2[]; void init() { ; i<; i++) g[i].clear(); } int main() { while(~scanf…
给一字符串,每次操作把字符串中的两种字母交换,问最后交换完的字符串是多少 arr数组记录每个字母最后被替换成了哪个字母 读入字符前面加一空格 scanf(" %c %c", &a, &b);  #include <iostream> #include <cstdio> using namespace std; #define SZ 200005 char c[SZ]; int main() { int n, m; ]; scanf("%…
CodeForces 591A 题意:在距离为L的两端A,B,相向发射魔法,a(以P1的速度)-->B,A<--b(以P2的速度).假设a-->B,途中相遇,则返回到原点A<--a. 后又继续,a-->B,速度不变. b亦是如此.求第二次相遇时a的位移. 思路:因为速度不变,所以第二次相遇地点与第一次相遇地点一样. res= n/(Va+Vb)*Va 代码: #include <iostream> #include <cstdio> #include…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…