VJ题目链接

题意:模拟输出表格

思路:模拟……很暴力

代码:

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std; int graph[][]; int main() {
int n;
while (scanf("%d", &n) != EOF) {
if (n == ) break;
memset(graph, , sizeof(graph)); int maxcol = ;
for (int i = ; i < n; i++){
int m;
scanf("%d", &m);
for (int j = ; j < m; j++) {
int row, col;
scanf("%d%d", &row, &col);
int bgc = ;
while (graph[i][bgc] != ) bgc++;
col = bgc+col;
row = i+row;
int id = (i+)*+bgc+;
maxcol = max(maxcol, col);
for (int r = i; r < row; r++) {
for (int c = bgc; c < col; c++) {
graph[r][c] = id;
}
}
}
} //for (int i = 0; i < n; i++) {
// for (int j = 0; j < maxcol; j++) {
// printf("%d ", graph[i][j]);
// }puts("");
//}puts(""); for (int i = ; i < maxcol; i++) {
printf(" --");
}puts(""); for (int i = ; graph[i][]; i++) {
//Line
printf("|");
for (int j = ; graph[i][j]; j++) {
if (graph[i][j] == (i+)*+j+) printf("%d", graph[i][j]);
else printf(" ");
if (graph[i][j] == graph[i][j+]) printf(" ");
else printf("|");
}puts(""); //Button
int store = ;
for (int j = ; graph[i][j]; j++) {
if (graph[i][j] == graph[i+][j]) store++;
else {
while (store) {
printf(" ");
store--;
}
printf(" --");
}
}puts("");
}
puts("");
}
return ;
}

最新文章

  1. 在centos7中添加一个新用户,并授权
  2. Ubuntu 安装 CLI 并运行 ASP.NET Core 1.0
  3. Python爬虫Scrapy框架入门(0)
  4. 热更新脚本C#light,ulua,Scorpio性能比较
  5. BZOJ1036 树的统计
  6. MongoDB 权限
  7. 如何动态添加和删除一个div
  8. Linux开机自动挂载Windows分区
  9. JavaScript 插件的书页翻转效果
  10. 改造 vue-cli 脚手架
  11. 20175214 《Java程序设计》第8周学习总结
  12. javascript基础 之 void
  13. mongoDB2.6,java使用具体解释
  14. aiojobs
  15. TCP 基础知识
  16. pycharm 的包路径设置export PYTHONPATH=$PYTHONPATH
  17. java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper
  18. ecshop,大商创后台设置增加字段方法
  19. 【thrift】thrift详解
  20. Centos7安装python3.7.1并与python2共存

热门文章

  1. “管中窥豹”,MyCAT的基因缺陷
  2. 《Cracking the Coding Interview》——第5章:位操作——题目4
  3. 每天一个Linux命令(3):ls命令
  4. java初学2
  5. ES6常用片段
  6. 【视觉SLAM14讲】ch3课后题答案
  7. VMware下Linux配置局域网和外网访问
  8. springboot08 jdbc
  9. JavaWeb笔记(七)Filter&amp;Listener
  10. luajit的字节码