CodeForces 989C
题意略。
思路:如图
详见代码:
#include<bits/stdc++.h>
#define maxn 55
using namespace std; char board[maxn][maxn]; void init(){
for(int i = ;i <= ;++i){
for(int j = ;j <= ;++j){
board[i][j] = 'A';
}
}
for(int i = ;i <= ;++i){
for(int j = ;j <= ;++j){
board[i][j] = 'B';
}
}
for(int i = ;i <= ;++i){
for(int j = ;j <= ;++j){
board[i][j] = 'C';
}
}
for(int i = ;i <= ;++i){
for(int j = ;j <= ;++j){
board[i][j] = 'D';
}
}
} int main(){
init();
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
--a,--b,--c,--d;
for(int i = ;i <= ;i += ){
if(a == ) break;
for(int j = ;j <= ;j += ){
if(a == ) break;
board[i][j] = 'A';
--a;
}
}
for(int i = ;i <= ;i += ){
if(b == ) break;
for(int j = ;j <= ;j += ){
if(b == ) break;
board[i][j] = 'B';
--b;
}
}
for(int i = ;i <= ;i += ){
if(c == ) break;
for(int j = ;j <= ;j += ){
if(c == ) break;
board[i][j] = 'C';
--c;
}
}
for(int i = ;i <= ;i += ){
if(d == ) break;
for(int j = ;j <= ;j += ){
if(d == ) break;
board[i][j] = 'D';
--d;
}
}
printf("50 50\n");
for(int i = ;i <= ;++i){
for(int j = ;j <= ;++j){
printf("%c",board[i][j]);
}
printf("\n");
} return ;
}
CodeForces 989C的更多相关文章
- Codeforces 989C - A Mist of Florescence
传送门:http://codeforces.com/contest/989/problem/C 这是一个构造问题. 构造一张网格,网格中的字符为’A’.’B’.’C’.’D’,并且其连通块的个数分别为 ...
- A Mist of Florescence CodeForces - 989C(思维构造)
题意: 让你构造一个图,使得A,B,C,D的个数为给定的个数,上下左右连通的算一个. 哎呀 看看代码就懂了..emm..很好懂的 #include <bits/stdc++.h> usin ...
- CCPC-Wannafly Summer Camp 2019 Day1
A - Jzzhu and Cities CodeForces - 449B 题意:n座城市,m条路,k条铁路啥的吧,然后要求最多能删多少条铁路保持1到$n$的最短路不变. 思路:因为铁路是从1出发的 ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
随机推荐
- JavaSE总结(二)
一.Java Number .65f;byte c =0x4a; 然而,在实际开发过程中,我们经常会遇到需要使用对象,而不是内置数据类型的情形.为了解决这个问题,Java 语言为每一个内置数据类型提供 ...
- C# backgroundwork的使用方法
引言:在 WinForms 中,有时要执行耗时的操作,在该操作未完成之前操作用户界面,会导致用户界面停止响应.解决的方法就是新开一个线程,把耗时的操作放到线程中执行,这样就可以在用户界面上进行其它操作 ...
- 201803-1跳一跳 CCF (C语言)
问题描述 近来,跳一跳这款小游戏风靡全国,受到不少玩家的喜爱. 简化后的跳一跳规则如下:玩家每次从当前方块跳到下一个方块,如果没有跳到下一个方块上则游戏结束. 如果跳到了方块上,但没有跳到方块的中心则 ...
- CCNA笔记(一)
R1#enable R1#configure terminal R1(config)#interface fastEthernet 0/0R1(config-if)#ip address 12.1.1 ...
- Divide and Conquer
1 2 218 The Skyline Problem 最大堆 遍历节点 public List<int[]> getSkyline(int[][] buildings) { ...
- 图解Redis之数据结构篇——整数集合
前言 整数集合(intset)并不是一个基础的数据结构,而是Redis自己设计的一种存储结构,是集合键的底层实现之一,当一个集合只包含整数值元素,并且这个集合的元素数量不多时, Redis i ...
- Linux零拷贝技术,看完这篇文章就懂了
本文首发于我的公众号 Linux云计算网络(id: cloud_dev),专注于干货分享,号内有 10T 书籍和视频资源,后台回复 「1024」 即可领取,欢迎大家关注,二维码文末可以扫. 本文讲解 ...
- Apache NiFi 核心概念和关键特性
本文来源于官方文档翻译 NiFi 的核心概念 NiFi 最早是美国国家安全局内部使用的工具,用来投递海量的传感器数据.后来由 apache 基金会开源.天生就具备强大的基因.NiFi基本设计理念与 F ...
- Java课堂 动手动脑6
一.下列语句哪一个将引起编译错误?为什么?哪一个会引起运行时错误?为什么? m=d;d=m;d=(Dog)m;d=c;c=(Cat)m; 先进行自我判断, 1.代码: class Mammal{} c ...
- 【Java笔记】【Java核心技术卷1】chapter3 D1JavaStandard
package chapter3;/*有包名,命令行编译javac -d . 名字.java(注意空格)运行时用java chapter3.JavaStandard*/ public/*访问修饰符*/ ...