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 ;
}

UVALive 6451:Tables(模拟 Grade D)的更多相关文章

  1. UVALive 4222 Dance 模拟题

    Dance 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...

  2. UVALive 3971 Assemble(模拟 + 二分)

    UVALive 3971 题意:有b块钱.想要组装一台电脑,给出n个配件的种类,名字,价格,品质因子.若各种类配件各买一个,总价格<=b,求最差品质配件的最大品质因子. 思路: 求最大的最小值一 ...

  3. UVA 1594:Ducci Sequence (模拟 Grade E)

    题意: 对于一个n元组(a0,a1,...),一次变换后变成(|a0-a1|,|a1-a2|,...) 问1000次变换以内是否存在循环. 思路: 模拟,map判重 代码: #include < ...

  4. UVA 1593: Alignment of Code(模拟 Grade D)

    题意: 格式化代码.每个单词对齐,至少隔开一个空格. 思路: 模拟.求出每个单词最大长度,然后按行输出. 代码: #include <cstdio> #include <cstdli ...

  5. uva 177:Paper Folding(模拟 Grade D)

    题目链接 题意:一张纸,每次从右往左对折.折好以后打开,让每个折痕都自然的呈90度.输出形状. 思路:模拟折……每次折想象成把一张纸分成了正面在下的一张和反面在上的一张.维护左边和方向,然后输出.细节 ...

  6. UVALive 3634 数据结构模拟

    这题真是坑啊,题意不明,其实就是往桟里面压入空的set集合,所以之前的询问大小都是只有0,只有add的时候,才会产生新的占空间的集合 用stack和set直接进行模拟 #include <ios ...

  7. UVALive - 6440(模拟)

    题目链接:https://vjudge.net/contest/241341#problem/G 题目大意:输入一个N,n次操作.对于第一种操作增加一个病人,告诉病人的t0,st0,r.第二种操作,在 ...

  8. UVA 1589:Xiangqi (模拟 Grade D)

    题目: 象棋,黑棋只有将,红棋有帅车马炮.问是否死将. 思路: 对方将四个方向走一步,看看会不会被吃. 代码: 很难看……WA了很多发,还越界等等. #include <cstdio> # ...

  9. UVALive 3664:Guess(贪心 Grade E)

    vj题目链接 题意: 有n (n<16345)个人,每个人有三个数(小于1000且最多两位小数点),表示答对对应题的得分.规定总分越高的人rank越高.总分相同,id小的rank高.现在知道ra ...

随机推荐

  1. redis系列文章目录

    redis系列文章目录 使用spring-data-redis实现incr自增 Redis 利用Hash存储节约内存 Redis学习笔记(九)redis实现时时直播列表缓存,支持分页[热点数据存储] ...

  2. CentOS7配置图形界面及设置vnc远程连接、windows远程桌面连接

    安装CentOS桌面 yum groupinstall "GNOME Desktop" 重启,进入终端,将启动模式变更为图形模式 systemctl set-default gra ...

  3. javascript类式继承模式#1——默认模式

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  4. 《Cracking the Coding Interview》——第14章:Java——题目6

    2014-04-26 19:11 题目:设计一个循环数组,使其支持高效率的循环移位.并能够使用foreach的方式访问. 解法:foreach不太清楚,循环移位我倒是实现了一个,用带有偏移量的数组实现 ...

  5. DOS程序员手册(十五)

    837页 writeln('TRACING Current Buffer==='); holdup; bcbtrc(cvtbase^.curbfr); writeln; holdup ; writel ...

  6. WPF and Silverlight.ComboBox 如何通过 Binding IsDropDownOpen 实现下拉菜单展开

    In the WPF example the Popup and the ToggleButton (the arrow on the right) are bound with the proper ...

  7. 就算WORD高手也无法解释的Word的一些疑惑.,一些已经解决,一些没有解决

    如下功能如何用? 1.选项->保存->显示其他保存位置(即使可能需要登录)? 解答:您能告诉我吗? 2.字体->为字体调整字间距? 解答:自动调整某些字符之前的距离,使得更加美观.例 ...

  8. 孤荷凌寒自学python第六十六天学习mongoDB的基本操作并进行简单封装5

    孤荷凌寒自学python第六十六天学习mongoDB的基本操作并进行简单封装5并学习权限设置 (完整学习过程屏幕记录视频地址在文末) 今天是学习mongoDB数据库的第十二天. 今天继续学习mongo ...

  9. (原)Unreal 渲染模块引言Temp

            @author:白袍小道     引言 本文只在对Unreal渲染模块做一些详细的理解,务求能分析出个大概. 其中框架的思想和实现的过程,是非常值得学习和推敲一二的. 涉及资源系统,材 ...

  10. Numpy 与 DataFrame对比与应用

    (一)对比Numpty 与 DataFrame默认索引取值不同点 Numpy索引取值 #Numpy索引取值 data=np.empty((2,4),dtype=int) print(data) ''' ...