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【模拟】的更多相关文章

  1. Voting CodeForces - 749C

    有点意思的题 Voting CodeForces - 749C 题意:有n个人投票,每次按照第1个人~第n个人的顺序发言,如果到某个人发言时他已经被禁止发言就跳过,每个人发言时可以禁止另一个人发言或什 ...

  2. Codeforces 749C:Voting(暴力模拟)

    http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人K ...

  3. Codeforces 749C. Voting 模拟题

    C. Voting time limit per test: 1 second memory limit per test: 256 megabytes input: standard input o ...

  4. Voting CodeForces - 749C (set,模拟)

    大意: n个人, 两个党派, 轮流投票, 两种操作(1)ban掉一个人 (2)投票, 每轮一个未被ban的人可以进行一次操作(1)或操作(2), 求最终哪个党派得票最多. 显然先ban人会更优, 所以 ...

  5. CodeForces - 427B (模拟题)

    Prison Transfer Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Sub ...

  6. CodeForces - 404B(模拟题)

    Marathon Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Sta ...

  7. Codeforces 709B 模拟

    B. Checkpoints time limit per test:1 second memory limit per test:256 megabytes input:standard input ...

  8. CodeForces - 404A(模拟题)

    Valera and X Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit ...

  9. Codeforces 390A( 模拟题)

    Inna and Alarm Clock Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64 ...

随机推荐

  1. Discuz系列1:安装

    http://www.discuz.net/forum.php     官网,点击“Discuz! 程序发布” 代码库: https://git.oschina.net/ComsenzDiscuz/D ...

  2. openssl之BIO系列之20---缓冲(buffer)类型BIO

    缓冲(buffer)类型BIO ---依据openssl doc\crypto\bio_f_buffer.pod翻译和自己的理解写成 (作者:DragonKing, Mail: wzhah@263.n ...

  3. Django学习之站点缓存详解

      本文和大家分享的主要是django缓存中站点缓存相关内容,一起来看看吧,希望对大家学习django有所帮助. 缓存整个站点,是最简单的缓存方法 在 MIDDLEWARE_CLASSES 中加入 “ ...

  4. BNUOJ 34978 汉诺塔 (概率dp)

    题目分析:对于 i 个盘 , 须要移动多少步,取决于最大的盘子在哪个杆上.在C杆上,则最大的盘不须要移动,由于初始状态一定是满足盘由下到上盘子依次变小的,仅仅须要移动i - 1个盘.假设在A杆上,则首 ...

  5. react-native填坑--react-navigation

    Navigator已经被React Native废弃了.也许你可以在另外的一个依赖库里react-native-deprecated-custom-components里找到.不过既然官方推荐的是re ...

  6. 【LeetCode】Construct Binary Tree from Preorder and Inorder Traversal

    Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that ...

  7. Python使用setuptools打包源文件(精简)

    目录结构: F:\capt>tree ├─abc_test │  ├─__init__.py │  ├─comman_line.py ├─setup.py #__init.py__ def he ...

  8. contentprovider 实例

    Provider端 public class PersonProvider extends ContentProvider { //用来存放所有合法的Uri的容器 private static Uri ...

  9. JTLParser-linux上jmeter的jtl文件二次分析

    解析JMeter的JTL文件 2013年01月30日 ⁄ 综合 ⁄ 共 1452字 ⁄ 字号 小 中 大 ⁄ 评论关闭   http://code.google.com/p/xtoolkit/wiki ...

  10. linux常用命令与技巧(不断添加与更新)

    linux常用命令:linux命令有很多,不去做全面的介绍与总结,这里只是记录在使用linux过程中遇到的常用命令和技巧,以便以后查阅. # mkdir -p /usr/local/src/ ##递归 ...