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. Android 自定义WebView 实现可以加载缓存数据

    1.自定义WebView说明 1.1.这个WebView可以加载缓存的数据.(需要后端配合,将html转换成一个字符串,主要是图片要用特殊格式) 1.2.注入了图片链接,为了方便点击webView中的 ...

  2. DNSSec

    Domain Name System Security Extensions (DNSSEC)DNS安全扩展,是由IETF提供的一系列DNS安全认证的机制(可参考RFC2535).它提供了一种来源鉴定 ...

  3. 数据库路由中间件MyCat - 源代码篇(2)

    此文已由作者张镐薪授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 2. 前端连接建立与认证 Title:MySql连接建立以及认证过程client->MySql:1.T ...

  4. viewDidLoad dispatch_sync

    - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"1"); dispatch_sync(dispatch_get_main_qu ...

  5. 打包成apk,生成apk文件,上传到网站服务器提供链接下载

    Android开发把项目打包成apk: 做完一个Android项目之后,如何才能把项目发布到Internet上供别人使用呢?我们需要将自己的程序打包成Android安装包文件--APK(Android ...

  6. USACO Section1.4 Arithmetic Progressions 解题报告

    ariprog解题报告 —— icedream61 博客园(转载请注明出处)-------------------------------------------------------------- ...

  7. 数据库——mysql内置功能(11)

    1.视图 视图是一个虚拟表(非真实存在),其本质是(根据SQL语句获取动态的数据集,并未其命名),用户使用时只需使用(名称)即可获取结果集,可以将该结果集当做表来使用 使用视图我们可以把查询过程中的临 ...

  8. ssh-debian87.sh

    #!/bin/bash sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config s ...

  9. makefile规则整理

    makefile规则整理 实际开发中,makefile改的多,写的少. 为了后面不要在编译链接这种地方花费太多的时间,在这里系统性的整理其规则: 基本格式 TARGET : PREREQUISITES ...

  10. PEAR DB 事务相关

    1.autoCommit().commit().rollback() function autoCommit($onoff=false) 指定是否自动提交事务.有的后端数据库不支持. function ...