A Mist of Florescence CodeForces - 989C(思维构造)
题意:
让你构造一个图,使得A,B,C,D的个数为给定的个数,上下左右连通的算一个。
哎呀 看看代码就懂了。。emm。。很好懂的
#include <bits/stdc++.h>
using namespace std;
const int maxn = , INF = 0x7fffffff;
char str[][];
int main()
{
for(int i=; i<; i++)
for(int j=; j<; j++)
if(i<)
str[i][j] = 'A';
else
str[i][j] = 'B';
int a, b, c, d;
cin>> a >> b >> c >> d;
a--, b--;
for(int i=; i<; i+=)
for(int j=; j<; j+=)
if(b)
str[i][j] = 'B', b--;
else if(d)
str[i][j] = 'D', d--;
for(int i=; i<; i+=)
for(int j=; j<; j+=)
if(a)
str[i][j] = 'A', a--;
else if(c)
str[i][j] = 'C', c--;
cout<< "" << " " << "" <<endl;
for(int i=; i<; i++)
{
cout<< str[i] <<endl;
} return ;
}
A Mist of Florescence CodeForces - 989C(思维构造)的更多相关文章
- 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 ...
- 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 ...
- CF989C A Mist of Florescence 构造 思维好题 第八题
A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes input standar ...
- CF思维联系– Codeforces-989C C. A Mist of Florescence
ACM思维题训练集合 C. A Mist of Florescence time limit per test 1 second memory limit per test 256 megabytes ...
- CF989C A Mist of Florescence (构造)
CF989C A Mist of Florescence solution: 作为一道构造题,这题确实十分符合构造的一些通性----(我们需要找到一些规律,然后无脑循环).个人认为这题规律很巧妙也很典 ...
- Codeforces A Mist of Florescence
A Mist of Florescence 题目大意: 事先告诉你每种颜色分别有几个联通块,构造一个不超过 \(50*50\) 的矩形.用 \(A,B,C,D\) 四种颜色来对矩形进行涂色使它满足要求 ...
- 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[]; ][ ...
- 【题解】CF989C A Mist of Florescence
[题解]CF989C A Mist of Florescence 题目大意: 让你构造一个\(n∗m\)矩阵,这个矩阵由4种字符填充构成,给定4个整数,即矩阵中每种字符构成的四联通块个数,\(n,m\ ...
- hdu4671 思维构造
pid=4671">http://acm.hdu.edu.cn/showproblem.php? pid=4671 Problem Description Makomuno has N ...
随机推荐
- 初学node.js-nodejs中实现HTTP服务(3)
一.node.js实现服务端 创建hello-world-server.js文件,服务端源码如下: /** * node.js实现http服务端 */ var http = require('http ...
- 02-matplotlib-散点图
import numpy as np import matplotlib.pyplot as plt ''' 散点图显示两组数据的值,每个点的坐标位置的值决定 用户观察两种变量的相关性: 正相关 负相 ...
- 【推荐系统】neural_collaborative_filtering(源码解析)
很久没看推荐系统相关的论文了,最近发现一篇2017年的论文,感觉不错. 原始论文 https://arxiv.org/pdf/1708.05031.pdf 网上有翻译了 https://www.cnb ...
- kali获得windows的shell后乱码
输入 chcp 65001
- Spring Bean注册解析(二)
在上文Spring Bean注册解析(一)中,我们讲解了Spring在注册Bean之前进行了哪些前期工作,以及Spring是如何存储注册的Bean的,并且详细介绍了Spring是如何解析 ...
- bash登录过程 其实还不太了解,先码后看
在刚登录Linux时,首先启动 /etc/profile 文件,然后再启动用户目录下的 ~/.bash_profile. ~/.bash_login或 ~/.profile文件中的其中一个,执行的顺序 ...
- MySql 赋值操作符"="与":="
MySql小点心—1.赋值操作符"="与":=" 对于刚接触到mysql的程序员来说,会对这两个符号有疑问,因为会发现有的代码里用这个有的用另一个. 当然他们是 ...
- LeetCode 655. Print Binary Tree (C++)
题目: Print a binary tree in an m*n 2D string array following these rules: The row number m should be ...
- 第26次Scrum会议(11/14)【欢迎来怼】
一.小组信息 队名:欢迎来怼小组成员队长:田继平成员:李圆圆,葛美义,王伟东,姜珊,邵朔,阚博文 小组照片 二.开会信息 时间:2017/11/14 11:35~11:57,总计22min.地点:东北 ...
- iOS开发学习-类似微信聊天消息中的电话号码点击保存到通讯录中的功能
类似微信聊天消息中的电话号码点击保存到通讯录中的功能,ABAddress的实现在iOS9中是不能正常使用的,点击完成后,手机会非常的卡,iOS9之后需要使用Contact新提供的方法来实现该功能.快捷 ...