Codeforces 749C【模拟】
FST的时候好像挂了挺多人的~
其实思路没啥难的,就是更好地理解题意吧,1到n一直循环,直到没有人能vote,一个人能vote也能叉掉一个人,一个人被叉就不能vote,判谁赢。
其实我管vote干嘛,我管好互叉就好了啊,直到局势一边倒,也就是不能叉了,谁多谁赢,这样肯定是要么D多R多,复杂度不大。
#include<bits/stdc++.h>
using namespace std;
typedef __int64 LL; const int N=2e5+10; bool vis[N];
char s[N];
int Dnum,Rnum;
int n,num; int main()
{
memset(vis,0,sizeof(vis));
scanf("%d",&n);
scanf("%s",s+1); Dnum=Rnum=0;
while(1)
{
int flag=false;
for(int i=1;i<=n;i++)
{
if(vis[i]) continue;
if(s[i]=='D')
{
if(Rnum)
{
flag=1;
vis[i]=1;
Rnum--;
}
else
Dnum++;
}
else
{
if(Dnum)
{
flag=1;
vis[i]=1;
Dnum--;
}
else
Rnum++;
}
}
if(!flag)
break;
}
if(Rnum)
printf("R");
else
printf("D");
return 0;
}
Codeforces 749C【模拟】的更多相关文章
- Voting CodeForces - 749C
有点意思的题 Voting CodeForces - 749C 题意:有n个人投票,每次按照第1个人~第n个人的顺序发言,如果到某个人发言时他已经被禁止发言就跳过,每个人发言时可以禁止另一个人发言或什 ...
- Codeforces 749C:Voting(暴力模拟)
http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人K ...
- Codeforces 749C. Voting 模拟题
C. Voting time limit per test: 1 second memory limit per test: 256 megabytes input: standard input o ...
- Voting CodeForces - 749C (set,模拟)
大意: n个人, 两个党派, 轮流投票, 两种操作(1)ban掉一个人 (2)投票, 每轮一个未被ban的人可以进行一次操作(1)或操作(2), 求最终哪个党派得票最多. 显然先ban人会更优, 所以 ...
- CodeForces - 427B (模拟题)
Prison Transfer Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Sub ...
- CodeForces - 404B(模拟题)
Marathon Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Sta ...
- Codeforces 709B 模拟
B. Checkpoints time limit per test:1 second memory limit per test:256 megabytes input:standard input ...
- CodeForces - 404A(模拟题)
Valera and X Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit ...
- Codeforces 390A( 模拟题)
Inna and Alarm Clock Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64 ...
随机推荐
- 九度OJ 1119:Integer Inquiry(整数相加) (大数运算)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:679 解决:357 题目描述: One of the first users of BIT's new supercomputer was ...
- tornado之异步web服务二
前面介绍了异步方法带来的显著性能提升.我们来看下异步使用的方法. 1 首先对于get方法使用tornado.web.asynchronous进行装饰.当使用tornado.web.asynchrono ...
- appcompat_v7出现红叉解决方法
右键属性,java build path 勾选Android5.5.2
- [转]FPGA入门——basys2开发板的伪随机gold码的生成
本文原创,转载请注明出处:http://www.cnblogs.com/risten/p/4166169.html 1.系统原理 通过频率控制字选择相位步进,产生访问ROM的地址,进而控制DAC的输出 ...
- typeof详解
typeof operator 返回了表示对象类型的字符串 下表列出了typeof可能的返回值. Type Result Undefined "undefined" Null &q ...
- 关于C语言声明数组时省略长度
C语言在声明数组时必须明确长度,如下两种方式: (一) 直接指定长度.如: int a[5]; (二) 声明时初始化元素.如:int a[]={1,3,5}. 如果,直接int a[]; 是不可以的 ...
- 转,如果linux不能用yum安装asterisk时,可以库参照以下办法添加asterisk仓库
LinuxCentOSRedHat Installing a binary distribution of Asterisk makes it easier to maintain your syst ...
- CodeForces - 840D:(主席树求出现区间出现次数大于某值的最小数)
Once, Leha found in the left pocket an array consisting of n integers, and in the right pocket q que ...
- BZOJ_2989_数列&&BZOJ_4170_极光_KDTree
BZOJ_2989_数列&&BZOJ_4170_极光_KDTree Description "若是万一琪露诺(俗称rhl)进行攻击,什么都好,冷静地回答她的问题来吸引她.对方 ...
- 「LuoguP1379」 八数码难题(迭代加深
[P1379]八数码难题 - 洛谷 题目描述 在3×3的棋盘上,摆有八个棋子,每个棋子上标有1至8的某一数字.棋盘中留有一个空格,空格用0来表示.空格周围的棋子可以移到空格中.要求解的问题是:给出一种 ...