模拟 Codeforces Round #249 (Div. 2) C. Cardiogram
题目地址:http://codeforces.com/contest/435/problem/C
/*
题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:)
模拟题:蛮恶心的,不过也简单,依据公式得知折线一定是一上一下的,只要把两个相邻的坐标之间的折线填充就好
注意:坐标有可能为负数,所以移动值y初始化为1000,最后要倒过来输出
详细解释:http://blog.csdn.net/zhb1997/article/details/27877783
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
int map[MAXN<<][MAXN<<];
int a[MAXN]; int main(void) //Codeforces Round #249 (Div. 2) C. Cardiogram
{
//freopen ("G.in", "r", stdin); int n;
while (~scanf ("%d", &n))
{
int tot = ; int mx = , mn = , x = , y = ;
for (int i=; i<=n; ++i) scanf ("%d", &a[i]), tot += a[i]; memset (map, , sizeof (map));
for (int i=; i<=n; ++i)
{
x++;
if (i & ) //奇数一定'/'
{
a[i]--;
map[y][x] = ;
while (a[i]--)
{
x++; y++;
map[y][x] = ;
}
mx = max (mx, y);
}
else //偶数一定'\'
{
a[i]--;
map[y][x] = ;
while (a[i]--)
{
x++; y--;
map[y][x] = ;
}
mn = min (mn, y);
}
} //printf ("%d %d\n", mx, mn);
for (int i=mx; i>=mn; --i) //y坐标
{
for (int j=; j<=tot; ++j) //x坐标
{
if (map[i][j] == ) printf ("/");
else if (map[i][j] == ) printf ("\\");
else printf (" ");
}
puts ("");
}
} return ;
}
模拟 Codeforces Round #249 (Div. 2) C. Cardiogram的更多相关文章
- Codeforces Round #249 (Div. 2) C. Cardiogram
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- 模拟 Codeforces Round #203 (Div. 2) C. Bombs
题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...
- 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie
题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...
- queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards
题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...
- Codeforces Round #249 (Div. 2) (模拟)
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #249 (Div. 2) C题,模拟画图 ----未解决!
http://codeforces.com/contest/435/problem/C
- Codeforces Round #249 (Div. 2) 总结
D.E还是很难的.....C不想多说什么... A:提意:给出每一组人的个数,以及一次车载容量,求出最少需要多少次才能载走所有的人. water: http://codeforces.com/cont ...
- 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels
题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...
随机推荐
- 用了那么久居然没发现firefox快捷键有如此多
firefox用了也有好几年了,除了ytkah经常用到的搜索Ctrl+F.加入书签Ctrl+D.打开新便签Ctrl+T,鼠标右键菜单,还安装了鼠标手势插件FireGestures,快速关闭标签.撤销关 ...
- editplus如何插入当前时间_Ctrl+D
之前的工作日志一般都是用excel来写的,但那个占用内存有点大,有时也比较麻烦,有时内容一行没办法显示,会自动截断,有点类似缩略图,无法一目了然 习惯了使用editplus,轻便快速,不占内存.但是有 ...
- 谷歌浏览器 DEV Tools
谷歌浏览器如今是Web开发者们所使用的最流行的网页浏览器.伴随每六个星期一次的发布周期和不断扩大的强大的开发功能,Chrome变成了一个必须的工具.大多数可能熟悉关于chorme的许多特点,例如使用c ...
- nginx(三)初步搭建nginx虚拟主机
上面就是nginx基于域名.ip访问的配置,掌握住格式,就很好配置了. 一.基于域名的虚拟主机的配置:1.我们在此复习一下DNS的配置:[root@mgmserver /]# hostnamemgms ...
- BZOJ 1058
服气!我果然就是个傻逼. 傻兮兮地感觉两个数之间的差距无需删除一些答案,妈个鸡就只加入了一些新的答案忘记了去掉无效的答案.我果然是傻逼,经验不足脑子笨... 这么水的题...不说了,说多了都是泪. 自 ...
- wireshark http抓包命令行详解
This article is a quick and easy HowTo detailing the use of Wireshark or another network sniffing pr ...
- 《ASP.NET MVC4 WEB编程》学习笔记------ViewBag、ViewData和TempData的使用和区别
本文转自大卫Baby ViewBag和ViewData其实是互通的ViewBag和ViewData的区别:ViewBag 不再是字典的键值对结构,而是 dynamic 动态类型,它会在程序运行的时候动 ...
- Greedy:Stall Reservations(POJ 3190)
牛挤奶 题目大意:一群牛很挑剔,他们仅在一个时间段内挤奶,而且只能在一个棚里面挤,不能与其他牛共享地方,现在给你一群牛,问你如果要全部牛都挤奶,至少需要多少牛棚? 这一题如果把时间区间去掉,那就变成装 ...
- PageBean分页组件
Page.java package org.guangsoft.bean; import java.util.List; public class Page { private int current ...
- atom 震动特效
1.下载atom 2.配置环境变量 3.运行apm install activate-power-mode 4.打开Atom激活(control+alt+o(是o不是零)) 注:新标签若没效果可以ct ...