A. A Blend of Springtime(暴力/模拟)

题目大意

给出$n$个花,每个点都有自己的颜色,问是否存在连续大于等于三个花颜色均不相同

sol

直接模拟判断即可

#include<cstdio>
#include<cstring>
using namespace std;
const int MAXN = ;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int a[MAXN][];
char s[MAXN];
int main() {
#ifdef WIN32
//freopen("a.in", "r", stdin);
#endif
scanf("%s", s + );
int N = strlen(s + );
for(int i = ; i <= N; i++) {
if(s[i] == 'A') a[i - ][] = , a[i + ][] = , a[i][] = ;
if(s[i] == 'B') a[i - ][] = , a[i + ][] = , a[i][] = ;
if(s[i] == 'C') a[i - ][] = , a[i + ][] = , a[i][] = ;
}
for(int i = ; i <= N; i++) {
if(a[i][] == && a[i][] == && a[i][] == ) {
puts("Yes"); return ;
}
}
puts("No");
return ;
}

A

B. A Tide of Riverscape(暴力/模拟)

题目大意

给定一段序列,由$“1”,“0”,“.”$组成,其中$.$代表不确定是$“1”$还是$“0”$,

给定一个$p$,问这个序列是否满足对于$i + P <= N$的$i$,存在$i$与$i+P$位置的字符不同。

sol

大力特判两个位置是否可以满足

#include<cstdio>
#include<cstring>
using namespace std;
const int MAXN = ;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int N, P;
char s[MAXN];
#define GG puts("No"); return 0;
int main() {
#ifdef WIN32
//freopen("a.in", "r", stdin);
#endif
scanf("%d %d", &N, &P);
scanf("%s", s + );
bool flag = ;
for(int i = ; i <= N - P; i++) {
if(s[i] == '') {
if(s[i + P] == '') {flag = ; break;}
if(s[i + P] == '.') {s[i + P] = ''; flag = ; break;}
}
if(s[i] == '') {
if(s[i + P] == '') {flag = ; break;}
if(s[i + P] == '.') {s[i + P] = ''; flag = ; break;}
}
if(s[i] == '.') {
if(s[i + P] == '') {s[i] = ''; flag = ; break;}
if(s[i + P] == '') {s[i] = ''; flag = ; break;}
if(s[i + P] == '.') {s[i] = ''; s[i + P] = ''; flag = ; break;}
}
}
if(flag == ) {puts("No"); return ;}
for(int i = ; i <= N; i++) {
if(s[i] == '.') putchar('');
else putchar(s[i]);
}
return ;
}

B

C. A Mist of Florescence(构造)

题目大意

给出四个数$a,b,c,d$,构造一个矩阵满足$“A”,"B","C","D"$对应联通块的数量为$a,b,c,d$

sol

考场上没想出来,思维太局限了,看到$n,m<=50$但是没有把它作为突破口。

正解非常刁钻,一图解千愁,不过我写的和正解不太一样,我是每三个空格放一个。

#include<cstdio>
using namespace std;
const int MAXN = ;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int mp[MAXN][MAXN];
int color[MAXN] = {, , , , };
char ans[MAXN] = {' ', 'A', 'B', 'C', 'D'};
int a[];
int main() {
#ifdef WIN32
//freopen("a.in", "r", stdin);
#endif
//int a = read() - 1, b = read() - 1, c = read() - 1, d = read() - 1;
for(int i = ; i <= ; i++) a[i] = read() - ;
for(int i = ; i <= ; i++)
for(int k = color[i] * + ; k <= color[i] * + ; k++)
for(int j = ; j <= ; j++)
mp[k][j] = color[i] + ; /* for(int i = 1; i <= MAXN - 1; i++, puts(""))
for(int j = 1; j <= MAXN - 1; j++)
printf("%d ", mp[i][j]); */
for(int i = ; i <= ; i++) {
int num = a[i];
for(int k = color[ - i] * + ; num > && k <= color[ - i] * + ; k++) {
for(int j = + (k & ); num > && j <= ; j += )
mp[k][j] = color[i] + , num--;
}
}
printf("48 50\n");
for(int i = ; i <= ; i++, puts(""))
for(int j = ; j <= ; j++)
putchar(ans[mp[i][j]]);
return ;
}

C

总结

又是两题滚粗,不过值得庆幸的是前两题都是1A,T3没做出来确实比较遗憾

以前从来没做过构造题也是原因之一

感觉T3这种题是有点套路的,最重要的是不要相信它给的样例!!!

然后应该把思维打开,多在宏观角度构造构造。

Codeforces Round #487 (Div. 2)的更多相关文章

  1. Codeforces Round #487 (Div. 2) C - A Mist of Florescence

    C - A Mist of Florescence 把50*50的矩形拆成4块 #include<bits/stdc++.h> using namespace std; ],b[]; ][ ...

  2. Codeforces Round #487 (Div. 2) 跌分有感

    又掉分了 这次的笑话多了. 首先,由于CF昨天的比赛太早了,忘记了有个ER,比赛开始半个小时才发现. 于是只能今天了. 嗯哈. 今天这场也算挺早的. 嗯嗯,首先打开A题. 草草看了一遍题意,以为不是自 ...

  3. C. A Mist of Florescence ----- Codeforces Round #487 (Div. 2)

    C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes input stan ...

  4. Codeforces Round #487 (Div. 2) E. A Trance of Nightfall (矩阵优化)

    题意 有一个平面 , 给你 \(n\) 个点构成一个点集 \(S\) , 一开始可以选择一个平面上任意点 \(P\) . 存在一种操作 : 1 选择一条至少 通过 \(S\) 中任意两个点以及 \(P ...

  5. Codeforces Round #487 (Div. 2) A Mist of Florescence (暴力构造)

    C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. code forces Codeforces Round #487 (Div. 2) C

    C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes input stan ...

  7. Codeforces Round #487 (Div. 2) C. A Mist of Florescence 构造

    题意: 让你构造一个 n∗mn*mn∗m 矩阵,这个矩阵由 444 种字符填充构成,给定 444 个整数,即矩阵中每种字符构成的联通块个数,n,mn,mn,m 需要你自己定,但是不能超过505050. ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. Oracle INSERT ALL 语句介绍

    描述 Oracle INSERT ALL 语句用来用一个 INSERT 语句添加多行.该行可以只使用一个SQL命令插入到一个表或多个表. 语法 Oracle INSERT ALL 语法如下: INSE ...

  2. TextSwitcher(文本切换器)和ViewFlipper

    1.TextSwitcher 使用: 应用分为三步: 1.得到 TextSwitcher 实例对象   TextSwitcher switcher = (TextSwitcher) findViewB ...

  3. 1 如何使用pb文件保存和恢复模型进行迁移学习(学习Tensorflow 实战google深度学习框架)

    学习过程是Tensorflow 实战google深度学习框架一书的第六章的迁移学习环节. 具体见我提出的问题:https://www.tensorflowers.cn/t/5314 参考https:/ ...

  4. Node Sass could not find a binding for your current environment

    Node环境从8升级到10后,Node Sass could not find a binding for your current environment 标签(空格分隔): Node Node环境 ...

  5. linux下查看磁盘文件系统

    df -Th fdisk -l parted -l lsblk -f blkid

  6. Exchange 2016 体系结构简介

    一.Exchange 2016简介 现在,CPU计算能力的成本显著降低,不再成为约束因素.随着此约束因素的消失,Exchange2016的主要设计目标是简化扩展.提高硬件利用率和实现故障隔离:在Exc ...

  7. July 18th 2017 Week 29th Tuesday

    My heart is stronger now that you are in it. 我的心里有了你,从此变得更强大. You will no longer feel lonely if ther ...

  8. S/4HANA业务角色概览之订单到收款篇

    大家好我叫Sean Zhang,中文名张正永.目前在S/4HANA产品研发部门任职产品经理,而这一阶段要从2017年算起,而在那之前接触更多还是技术类的,比如做过iOS.HANA.ABAP.UI5等等 ...

  9. MySQL闪回-binlog2sql

    功能 提取SQL 生成回滚SQL     限制: mysql server必须开启,离线模式下不能解析binlog. binlog格式必须是row模式. flashback模式只支持DML,DDL将不 ...

  10. java中的泛型2--注意的一些问题和面试题

    前言 这里总结一下泛型中需要注意的一些地方和面试题,通过面试题可以让你掌握的更清楚一些. 泛型相关问题 1.泛型类型引用传递问题 在Java中,像下面形式的引用传递是不允许的: ArrayList&l ...