Putting Plates 摆盘

来源codeforses #1530B
1200
链接: [link](链接: link.
time limit per test: 2 seconds
每次测试的时间限制:2秒

memory limit per test: 512 megabytes
每次测试的内存限制:512兆字节

input: standard input
输入:标准输入

output: standard output
产出:标准产出

To celebrate your birthday you have prepared a festive tablel Now you want to seat as many guests as possible.
为了庆祝你的生日,你已经准备了一个节日餐桌,现在你想要座位尽可能多的客人。

The table can be represented as a rectangle with height h and with u, divided into h x u clls.Let (i,j) denote the cellin the i-th ow and
表可以表示为高度h和u的矩形,分为hx u cll,设(i,j)表示i-th中的单元格,

the j-th column of the rectangle (1 <i<h;1<j <w).
矩形的j列(1<i<h;1<j<w).

lnto each cell of the table you can either put a plate or keep it empty.
在桌子的每个细胞里,你要么放一个盘子,要么把它空着。

As each guest has to be seated next to their plate, you can only putplates on the edge of the table— into the firstor the last row of the
因为每位客人都必须坐在他们的盘子旁边,所以你只能把盘子放在桌子的边缘–放在桌子的第一排或最后一行。

rectangle, or into the first or the last column.Formally,for each cell (i,j) you put a plate into, at least one of the following conditions must be
对于每个单元格(i,j),至少要有以下条件之一:

satisfied:i— 1,i—h,j=1,j= w.
满意:i-1,i-h,j=1,j=w.

To make the guests comfortable, no two plates must be put into cells that have a common side or comer.Iin other words fcell(i,j) contains a
为了让客人感到舒服,不要把两个盘子放进有共同侧面或角落的牢房里。换句话说,FCell(I,j)包含一个

plate, you can’t put plates into cells(i—1,j).(i,j一1).(i++1,j).(i,j+1).(i—1,j-1).(i—1,j+1).(i+1,j-1).
(i+1,j).(i+1,j).(i,j+1).(i-1,j-1).(i-1,j+1).(i+1,j-1).(i+1,j-1)。

(+1,j+1).
(+1,j+1).

Put as many plates on the table as possible without violating the rules above.
把尽可能多的盘子放在桌子上,而不违反上面的规则。

lnput
输入

The first line contains a single integert (1 <t <100)—the number of test cases.
第一行包含一个整数(1<t<100)–测试用例的数量。

Each of the following t lines describes one test case and contains two integers h and u(3<h,u<20)—the height and the width of the
下面的t行描述一个测试用例,并包含两个整数h和u(3<h,u<20)–高度和宽度

table.
桌子。

Output
输出量

For each test case,print h lines containing u characters each.Character jin line i must be equal to 1 if you are putng a plale itocll(,j)
对于每个测试用例,都要打印包含u个字符的h行,如果要输入Plale itocll(,j),则字符jin行i必须等于1。

and 0 otherwise.
否则就0。

All plates must be put on the edge of the table.No two plates can be put into cells that have a common side or comer.The umber of plates
所有的盘子都必须放在桌子的边缘上。没有两个盘子可以放在有共同侧面或凹凸的细胞里。

put on the table under these conditions must be as large as possible.
在这些条件下摆在桌面上的人必须尽可能大。

You are allowed to print additional empty lines.
允许打印其他空行。

构造

int main()
{int n;cin >> n;while (n--){bool map[21][21] = { 0 };int h, w;cin >> h >> w;map[0][0] = 1;//1map[0][w - 1] = 1;map[h - 1][0] = 1;map[h - 1][w - 1] = 1;for (int i = 2; i < w-1; ++i)//1-{if (!map[0][i - 1]&& !map[0][i+1])map[0][i] = 1;}for (int i = 2; i < h-1; ++i)//2|{if (!map[i - 1][0]&&!map[i+1][0])map[i][0] = 1;}for (int i = 2; i < w-1; ++i)//3- -{if (!map[h - 1][i - 1] && !map[h - 2][i - 1]&& !map[h - 1][i +1] && !map[h - 2][i +1])map[h - 1][i] = 1;}for (int i = 1; i < h-1; ++i)//4| |{if (!map[i - 1][w - 1] && !map[i - 1][w - 2]&&!map[i+1][w -1]&&!map[i+1][w-2])map[i][w - 1] = 1;}for (int i = 0; i < h; ++i){for (int j = 0; j < w; ++j){cout << map[i][j];}cout << endl;}}return 0;
}

Putting Plates 摆盘相关推荐

  1. 天津盈克斯机器人科技_柔性视觉选料 机器人摆盘 柔性振动盘

    视觉供料.视觉振盘.柔性振盘.柔性选料,柔性上料,柔性供料,柔性振动盘, flexfactory,机器人上料,视觉上料.柔性供料器,视觉选料.视觉振动盘.flexfeeder 柔性振盘530,规格FF ...

  2. CodeForces Gym 101047L Putting plates on the tuk-tuks 快速幂

    Putting plates on the tuk-tuks Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d ...

  3. 三菱5U摆盘机程序六轴此程序包含组态

    三菱5U摆盘机程序六轴此程序包含组态整套比较成熟,附流程图. 已经在设备上实际应用,运用大型Q系列程序思维精心完成. 采用模块化编程框架,具备很大的参考价值. 是三菱最新的5UPLC系统. 此款PLC ...

  4. #Codeforces Round #733_B. Putting Plates

    B. Putting Plates 题目传送门: 题目传送门 题面: 题目大意: 意思是说一个矩阵长宽为 h , w h,w h,w,内部先全部变成0,只能在最外围那一圈把0变成1,规则是这个1九宫格 ...

  5. 高速柔性分选摆盘设备全自动IC芯片整列摆盘机半导体自动排列机

    [品牌]中天智能 [型号]ZTi-FB800 [机架]钣金一体成型机架 [运动模组]直线电机.双动子 [视觉系统]上视觉*3  下视觉飞拍*2 [吸头结构]ZR运动吸头*8 [柔性振动盘]取料范围30 ...

  6. 岳阳机器人餐厅在哪_普渡科技推出送餐与回盘两款全新餐饮机器人,打造“一来一回”新闭环...

    [环球网科技综合报道]12月19日,室内智能配送机器人企业普渡科技正式发布首款送餐机器人"贝拉BellaBot"与首款回盘机器人"好啦HolaBot",希望通过 ...

  7. 小龙虾炒菜机器人_“机器人”炒菜?5分钟一盘小龙虾!8分钟一份红烧肉

    原标题:"机器人"炒菜?5分钟一盘小龙虾!8分钟一份红烧肉 3分钟做好一份麻婆豆腐,4分钟可以做好一份让人垂涎欲滴的咸肉春笋,5分钟一盘香喷喷的麻辣小龙虾可以端上桌,完全解放双手, ...

  8. 小龙虾炒菜机器人_5分钟一盘小龙虾,8分钟一份红烧肉,幕后高手原来是“她”…...

    原标题:5分钟一盘小龙虾,8分钟一份红烧肉,幕后高手原来是"她"- 3分钟做好一份麻婆豆腐,4分钟可以做好一份让人垂涎欲滴的咸肉春笋,5分钟一盘香喷喷的麻辣小龙虾可以端上桌,完全解 ...

  9. 机器视觉运动控制一体机应用例程|柔性振动盘上料解决方案

    一.什么是柔性振动盘? 柔性振动盘作为高度灵活的.可自定零件的自动化柔性上料机构,解决了由于零件的大小.形状不一导致金属/塑料的零部件产品难以上料的难题.适用于更新换代快,频繁切换物料的工业应用场景, ...

最新文章

  1. Topcoder SRM 663 DIV 1
  2. spring aop实例讲解_小实例理解Spring中的AOP----面向切面编程
  3. Eclipse运行Applet没有显示图片,getCodeBase,getDocumentBase
  4. OutLook2016修改注册表迁移.ost文件数据
  5. 飞凌开发板 cramfs 镜像文件修改
  6. OpenAI发布CLIP模型快一年了,盘点那些CLIP相关让人印象深刻的工作
  7. [导入]Spring Web Flow
  8. 订单生产计划表范本_生产计划表_用Excel 如何制作生产排单的生产计划
  9. VCPKG 升级问题
  10. Java项目Maven配置操作Pdf
  11. ubuntu 下sopcast的使用
  12. ffmpeg 转换flv压缩大小_ffmpeg 视频压缩 转换
  13. 当我们谈论跳槽时在谈论什么
  14. 百度地图显示多个标注点
  15. 2009中文菜谱网站排行之十大兵器
  16. java生成唯一订单号
  17. Quartz之CronExpression
  18. 自动驾驶(三十四)---------可行驶区域检测
  19. 电影《名侦探柯南:万圣节的新娘》观后感
  20. c语言编程显示未定义的引用,c – 链接时奇怪的未定义引用

热门文章

  1. CTF【每日一题20160613】
  2. HTML DOM selectedIndex 属性
  3. google 2008实习生招聘
  4. Ubuntu 中Gitbook 使用笔记
  5. 面向对象程序设计的基本概念
  6. PHP socket 概述
  7. Oracle经纬度查询最近sql,SQL语句计算经纬度距离
  8. 大数据交互平台Hue的优势
  9. 谈谈过去十五年身处教师家庭是什么感受
  10. P1024 一元三次方程求解 两种方法