Codeforces Round #205 (Div. 2) : D
思维题,感叹自己的智商不够啊。
思路大概是这样的:
1.排在队伍前面的女生是不用换位置的;
2.女生在队伍中的顺序是不会变的;
3.最后一个女生稳定了则程序结束;
4.每个女生都有个初始位置和最终位置。如果一个女生的初始位置减去最终位置>现在的最大值,则最大值更新;
否则最大值+1;
代码:
#include<cstdio>
using namespace std;
char s;
int main()
{
int r=,f=,l=;
while(getchar()=='F');
while((s=getchar())=='F'||s=='M')
{
if(s=='F')
{
if(f-l>r)r=f-l;
else r++;
l++;
}
f++;
}
printf("%d\n",r);
return ;
}
Codeforces Round #205 (Div. 2) : D的更多相关文章
- Codeforces Round #205 (Div. 2)C 选取数列可以选择的数使总数最大——dp
http://codeforces.com/contest/353/problem/C Codeforces Round #205 (Div. 2)C #include<stdio.h> ...
- Codeforces Round #205 (Div. 2)
A #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> ...
- Codeforces Round #205 (Div. 2) : C
感觉像是一个数位dp,高位的1如果不选的话,前面低位的数都可以选:不然只能选择为1的数: 代码: #include<iostream> #include<algorithm> ...
- Codeforces Round #205 (Div. 2) : B
如果某个数出现的次数大于或等于2次,那么平均分配到两个容器里面: 这里利用一个k来使得当出现次数为奇数时候分配得更加均匀: 剩下的就平均分配到两个容器里: 代码: #include<iostre ...
- Codeforces Round #205 (Div. 2) : A
题意: 要求找到最少次数的交换次数使得两组数都是偶数: 很明显答案要么是0,要么是1,或者不管怎么交换都不行(-1): 所以: #include<cstdio> #define maxn ...
- Codeforces Round 536 (Div. 2) (E)
layout: post title: Codeforces Round 536 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- Codeforces Round #506 (Div. 3) D-F
Codeforces Round #506 (Div. 3) (中等难度) 自己的做题速度大概只尝试了D题,不过TLE D. Concatenated Multiples 题意 数组a[],长度n,给 ...
- Codeforces Round #608 (Div. 2) 题解
目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...
- Codeforces Round #579 (Div. 3)
Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include &l ...
随机推荐
- Linux下设置最大文件打开数nofile及nr_open、file-max
在开发运维的时候我们常常会遇到类似“Socket/File: Can’t open so many files”,“无法打开更多进程”,或是coredump过大等问题,这些都可以设置资源限制来解决.今 ...
- linux安装php出现的各种错误解决方案
configure: error: Try adding --with-zlib-dir=<DIR>. Please check config.log for more informati ...
- myeclipse2014新感悟
部署有两种方式:1.直接把文件拷贝到 tomcat下的webroot文件夹下 2.myeclipse软件内部点击“deploy”部署 →点击add→tomcat下的webroot文件夹下 点击完“运行 ...
- promise和Angular中的 $q, defer
在ES6语法中,新出了promise构造函数, 可用来生成promise实例. Promise对象: 代表了未来某个将要发生的事件(通常是一个异步操作).有了promise对象, 可以将异步操作以同步 ...
- centos6.7 install chrome
1.yum仓库 (如果用rpm包安装 可以忽略此步) vim /etc/yum.repos.d/google-chrome.repo [google-chrome] name=google-chrom ...
- RHEL7虚拟机中不重启的情况下加新硬盘及扩展根分区容量
在VMware中添加一块新的5G硬盘 显示当前分区 # fdisk -l 通常在你在虚拟机中添加一块新硬盘时,你可能会看到新硬盘没有自动加载.这是因为连接到硬盘的SCSI总线需要重新扫描来使得新硬盘可 ...
- chrome vim插件vimnum快捷键与使用
Navigating the page j : Scroll down (scrollDown) k : Scroll up (scrollUp) h : Scroll left (scrollLef ...
- Android pulltorefresh引用遇到的一个问题
今天在使用pulltorefresh插件的时候遇到了一个让人头疼的问题,在Eclipse中导入要用到的library项目,然后新建一个项目引入Library,显示的是引入成功,如图 而且project ...
- jquery 提示信息显示后自动消失的具体实现
方法一: 复制代码 代码如下: $("#errormsg").html("您的信息输入错误,请重试!").show(300).delay(3000).hide( ...
- PHP 根据值查找键名
array_search (PHP 4 >= 4.0.5, PHP 5) mixed array_search ( mixed $needle , array $haystack [, bool ...