博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CF1178E Archaeology
阅读量:4701 次
发布时间:2019-06-09

本文共 668 字,大约阅读时间需要 2 分钟。

考虑只有三个字符,所以每四个必然选出两个来,也就是不存在\(\rm impossible\)的情况

所以我们简单模拟就好了,从两端往中间扫,不匹配就移动一端,时间复杂度\(O(n)\)

代码:

#include
#include
#include
#include
using namespace std;#define rg registervoid read(int &x){ char ch;bool ok; for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1; for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;}const int maxn=1e6+10;char a[maxn],ans[maxn];int n,m,mx,sum;int pos[maxn],tot,w[3],s[3];int main(){ scanf("%s",a+1),n=strlen(a+1);m=n/2; if(n==2)return printf("%c",a[1]),0; int l=1,r=n; while(l

转载于:https://www.cnblogs.com/lcxer/p/11400976.html

你可能感兴趣的文章
Computer Systems A Programmer's Perspective(深入理解计算机系统)第一章读书笔记
查看>>
语义分析
查看>>
httperf ---linux web站点压力测试
查看>>
hdu-5583 Kingdom of Black and White(数学,贪心,暴力)
查看>>
(4)理解 neutron ml2---port创建流程代码解析
查看>>
免费资源:Polaris UI套件 + Linecons图标集(AI, PDF, PNG, PSD, SVG)
查看>>
C# winform 使用DsoFramer 创建 显示office 文档
查看>>
找工作的一些感悟——前端小菜的成长
查看>>
C#委托和事件的应用Observer模式实例
查看>>
codevs1018 单词接龙(DFS)
查看>>
内容分发系统MediaEW:助新闻媒体转投HTML5
查看>>
HTML5 Canvas ( 径向渐变, 升级版的星空 ) fillStyle, createRadialGradient
查看>>
Stanford Local Programming Contest 2011
查看>>
多线程中,NSOperationQueue和GCD的区别
查看>>
python生成.exe文件
查看>>
PHP面向对象(OOP)----分页类
查看>>
监听SD卡状态
查看>>
vs2017 EFCore 迁移数据库命令
查看>>
serialVersionUID的作用
查看>>
liunx trac 插件使用之GanttCalendarPlugin
查看>>