2016 Al-Baath University Training Camp Contest-1 D
Description
X is well known artist, no one knows the secrete behind the beautiful paintings of X except his friend Y, well the reason that Y knows X's secrete is that he is that secret. Y is a programmer and he helps X with drawing paintings using computer program written by him. Unfortunately Y program is not working any more, now it's your turn to help X by writing a program that helps him in painting, your program should accept a sequence of instructions, each will draw an opaque (filled) rectangle in the form: r1, c1, r2, c2, color. where (r1, c1) is the upper left corner of the rectangle and (r2, c2) is the lower right corner, and color is a character that denotes the color of this rectangle. all rectangles will be printed on a R by C plane, by default this plane is filled with dots (i.e. '.'). R and C between 1 and 100. for each instruction (1 ≤ ri ≤ R) and (1 ≤ ci ≤ C) and color is a ASCII character [a-z]. The number of instructions won't exceed 100 instructions.
The first line of input contains an integer T denotes number of test cases. The first line of each test case contains three integers R, C ,Iwhere R and C denotes number of rows and columns of the painting, and I denotes number of instructions. Each of the next I lines contains four integers r1,c1,r2,c2 and the color character.
Print the final plane after evaluating the instructions in order.
1
5 5 3
1 1 2 2 a
1 2 5 5 c
2 2 3 3 d
acccc
addcc
.ddcc
.cccc
.cccc
题意:从x1,y1画到x2,y2,颜色为c,问我们最后画出来的颜色分布
解法:暴力,原先画的颜色会被后面的覆盖
#include <iostream>
#include <cstring>
using namespace std;
int main(){
char a[105][105];
int T;
cin>>T;
while(T--){
int c,r,m,b[4];
cin>>r>>c>>m;
for(int i=1;i<=r;i++){
for(int k=1;k<=c;k++){
a[i][k]='.';
}
}
while(m--){
char ch;
for(int i=0;i<4;i++){
cin>>b[i];
}
cin>>ch;
for(int i=b[0];i<=b[2];i++){
for(int k=b[1];k<=b[3];k++){
a[i][k]=ch;
}
}
}
for(int i=1;i<=r;i++){
for(int k=1;k<=c;k++){
cout<<a[i][k];
}
cout<<endl;
}
}
return 0;
}
2016 Al-Baath University Training Camp Contest-1 D的更多相关文章
- 2016 Al-Baath University Training Camp Contest-1
2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...
- 2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest)
2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest) Problem A. M ...
- 2016 Al-Baath University Training Camp Contest-1 E
Description ACM-SCPC-2017 is approaching every university is trying to do its best in order to be th ...
- 2016 Al-Baath University Training Camp Contest-1 B
Description A group of junior programmers are attending an advanced programming camp, where they lea ...
- 2016 Al-Baath University Training Camp Contest-1 A
Description Tourist likes competitive programming and he has his own Codeforces account. He particip ...
- 2016 Al-Baath University Training Camp Contest-1 J
Description X is fighting beasts in the forest, in order to have a better chance to survive he's gon ...
- 2016 Al-Baath University Training Camp Contest-1 I
Description It is raining again! Youssef really forgot that there is a chance of rain in March, so h ...
- 2016 Al-Baath University Training Camp Contest-1 H
Description You've possibly heard about 'The Endless River'. However, if not, we are introducing it ...
- 2016 Al-Baath University Training Camp Contest-1 G
Description The forces of evil are about to disappear since our hero is now on top on the tower of e ...
- 2016 Al-Baath University Training Camp Contest-1 F
Description Zaid has two words, a of length between 4 and 1000 and b of length 4 exactly. The word a ...
随机推荐
- Java基础(5):试用Array类对数据进行操作(Sort和toString方法)
Arrays 类是 Java 中提供的一个工具类,在 java.util 包中.该类中包含了一些方法用来直接操作数组,比如可直接实现数组的排序.搜索等 1. 排序 语法: Arrays.sort(数 ...
- cookie和session区别
cookie和session区 session是在服务器端保存用户信息,cookie是在客户端保存用户信息 session保存的是对象,cookie保存的是字符串 session会随回话结束而关闭,c ...
- cocos游戏开发之海岛冒险1
1.首先在cocosStudio软件中新建项目:项目名称IslandAdventure:项目语言:C++ 2.在项目路径F:\cocos\MyProject\IslandAdventure如下: 3. ...
- Android自定义ScrollView实现一键置顶功能
效果图如下: (ps:动态图有太大了,上传不了,就给大家口述一下要实现的功能吧) 要实现的功能:当ScrollView向上滑动超过一定距离后,就渐变的出现一个置顶的按钮,当滑动距离小于我们指定的距离时 ...
- spark-submit常用参数
yarn模式默认启动2个executor,无论你有多少的worker节点 standalone模式每个worker一个executor,无法修改executor的数量 partition是RDD中的一 ...
- sql 表连接 join
inner join 和 join 的 区别 inner join 是内连接 ,查询出两边 都有的数据 join 是交叉 连接, 假设集合A={a, b},集合B={0, 1, 2},则两个集 ...
- 查看在线EBS用户的相关信息
--查看在线EBS用户的相关信息 SELECT PAP.FULL_NAME, FU.USER_NAME, FAT.APPLICATION_NAME, FRT.RESPONSIBILITY_NAME, ...
- django migrate10060 Duplicate column name错误
这个错误意思是有重复的列名,其实大部分原因是因为某些列被执行了多次,可以打开migration里面的django生成的文件去排查错误,然后自己手动修改数据库还原,实在不行可以把除了0001和init文 ...
- overflow的劲爆知识点
1.属性 visible(默认) hidden(此处是隐藏不是裁剪) scroll(滚动条) auto(智能路线 当超出范围时则出现滚动条) inherit 不常用 存在兼容性问题 2.进入CSS3 ...
- WordPress博客网站fonts.useso加载慢解决办法
WordPress博客网站fonts.useso加载慢解决办法 之前WordPress博客因为google字体库访问不了替换成360的useso,最近WordPress博客网站一直等待fonts.us ...