思路:

有趣的构造题。

实现:

 #include <bits/stdc++.h>
using namespace std;
char ans[][];
void fillin(int x, int y, char c, int maxy, int cnt)
{
int a = x, b = y;
while (cnt)
{
ans[a][b] = c;
if (b + >= maxy) { a += ; b = y; }
else b += ;
cnt--;
}
}
int main()
{
int a, b, c, d;
while (cin >> a >> b >> c >> d)
{
for (int i = ; i < ; i++)
{
for (int j = ; j < ; j++)
{
ans[i][j] = 'A';
ans[i][j + ] = 'B';
ans[i + ][j] = 'C';
ans[i + ][j + ] = 'D';
}
}
fillin(, , 'B', , b - );
fillin(, , 'C', , c - );
fillin(, , 'D', , d - );
fillin(, , 'A', , a - );
cout << "50 50" << endl;
for (int i = ; i < ; i++)
{
for (int j = ; j < ; j++)
cout << ans[i][j];
cout << endl;
}
}
return ;
}

总结:

对于构造题,要尽量用简单的方法完成任务,不要自己徒增限制条件。

CF989C A Mist of Florescence的更多相关文章

  1. CF989C A Mist of Florescence (构造)

    CF989C A Mist of Florescence solution: 作为一道构造题,这题确实十分符合构造的一些通性----(我们需要找到一些规律,然后无脑循环).个人认为这题规律很巧妙也很典 ...

  2. 【题解】CF989C A Mist of Florescence

    [题解]CF989C A Mist of Florescence 题目大意: 让你构造一个\(n∗m\)矩阵,这个矩阵由4种字符填充构成,给定4个整数,即矩阵中每种字符构成的四联通块个数,\(n,m\ ...

  3. CF989C A Mist of Florescence 构造 思维好题 第八题

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

  4. CF989C A Mist of Florescence 构造

    正解:构造 解题报告: 先放传送门yep! 然后构造题我就都直接港正解了QwQ没什么可扯的QwQ 这题的话,首先这么想吼 如果我现在构造的是个4*4的 举个栗子 AABB ACBB AADB DBCA ...

  5. CF989C A Mist of Florescence 题解

    因为 \(1 \leq a,b,c,d \leq 100\) 所以每一个颜色都有属于自己的联通块. 考虑 \(a = b=c=d=1\) 的情况. AAAAAAAAAAAAAAAAAAAAAAAAAA ...

  6. 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[]; ][ ...

  7. 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 ...

  8. 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 ...

  9. Codeforces A Mist of Florescence

    A Mist of Florescence 题目大意: 事先告诉你每种颜色分别有几个联通块,构造一个不超过 \(50*50\) 的矩形.用 \(A,B,C,D\) 四种颜色来对矩形进行涂色使它满足要求 ...

随机推荐

  1. (linux)块设备驱动程序

      1.4.1  Linux块设备驱动程序原理(1) 顾名思义,块设备驱动程序就是支持以块的方式进行读写的设备.块设备和字符设备最大的区别在于读写数据的基本单元不同.块设备读写数据的基本单元为块,例如 ...

  2. bootstrap学习心得

    一.html的编写规范 <!DOCTYPE html> <html lang="zh-CN"> <head> <title>Page ...

  3. 【Nginx安装】CentOS7安装Nginx及配置

    [Nginx安装]CentOS7安装Nginx及配置 2018年03月05日 11:07:21 阅读数:7073 Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttp ...

  4. leelazero and google colab

    https://github.com/gcp/leela-zero/blob/master/COLAB.md 左侧菜单展开,可以查看细节

  5. html5--6-23 CSS3中的文字与字体

    html5--6-23 CSS3中的文字与字体 text-overflow 设置是否使用一个省略标记(...)标示对象内文本的溢出 clip: 默认值当对象内文本溢出时不显示省略标记(...),而是将 ...

  6. ss连接不上

    突然ss就连接不上了,而vps的ip能ping通,ssh也能登录. 折腾了半天都没解决. 后来解决了,关键点有两个 (1)更改ss的服务端口,原本是9000,随便改为其他的: (2)在switch里设 ...

  7. Android gif 录屏

    /********************************************************************************** * Android gif 录屏 ...

  8. [Java] 读取文件

    1.按字节读取文件内容2.按字符读取文件内容3.按行读取文件内容 4.随机读取文件内容 public class ReadFromFile { /** * 以字节为单位读取文件,常用于读二进制文件,如 ...

  9. Android开发中几种有用的的日历控件实现

    我们大家都知道,在Android平台3.0中才新增了日历视图控件,可以显示网格状的日历内容,那么对于3.0以下的版本要使用日历控件只能借助第三方,目前用的最多的是CalendarView. 先简单介绍 ...

  10. ASP.NET Core:template

    ylbtech-ASP.NET Core: 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部   5.返回顶部     6.返回顶部   作者:ylbtech出处:http://yl ...