题目地址: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的更多相关文章

  1. Codeforces Round #249 (Div. 2) C. Cardiogram

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts

    题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...

  3. 模拟 Codeforces Round #203 (Div. 2) C. Bombs

    题目地址:http://codeforces.com/problemset/problem/350/C /* 题意:机器人上下左右走路,把其他的机器人都干掉要几步,好吧我其实没读懂题目, 看着样例猜出 ...

  4. 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie

    题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...

  5. queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards

    题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...

  6. Codeforces Round #249 (Div. 2) (模拟)

    C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  7. Codeforces Round #249 (Div. 2) C题,模拟画图 ----未解决!

    http://codeforces.com/contest/435/problem/C

  8. Codeforces Round #249 (Div. 2) 总结

    D.E还是很难的.....C不想多说什么... A:提意:给出每一组人的个数,以及一次车载容量,求出最少需要多少次才能载走所有的人. water: http://codeforces.com/cont ...

  9. 模拟 Codeforces Round #288 (Div. 2) A. Pasha and Pixels

    题目传送门 /* 模拟水题:给定n*m的空白方格,k次涂色,将(x,y)处的涂成黑色,判断第几次能形成2*2的黑色方格,若不能,输出0 很挫的判断四个方向是否OK */ #include <cs ...

随机推荐

  1. java笔记--使用线程池优化多线程编程

    使用线程池优化多线程编程 认识线程池 在Java中,所有的对象都是需要通过new操作符来创建的,如果创建大量短生命周期的对象,将会使得整个程序的性能非常的低下.这种时候就需要用到了池的技术,比如数据库 ...

  2. 存在使i > j || i <= j不成立的数吗?

    存在使i > j || i <= j不成立的数吗? 咋一看有点晕!一个数既不能大于也不能小于等于另一个数?那是什么数?答案是”非数“ 例子如下:‘ if(Double.NaN>Flo ...

  3. 将JSON转成DataSet(DataTable)

    方法1: /// <summary> /// 将JSON解析成DataSet只限标准的JSON数据 /// 例如:Json={t1:[{name:'数据name',type:'数据type ...

  4. HDU 4911 http://acm.hdu.edu.cn/showproblem.php?pid=4911(线段树求逆序对)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4911 解题报告: 给出一个长度为n的序列,然后给出一个k,要你求最多做k次相邻的数字交换后,逆序数最少 ...

  5. Poj 3233 Matrix Power Series(矩阵二分快速幂)

    题目链接:http://poj.org/problem?id=3233 解题报告:输入一个边长为n的矩阵A,然后输入一个k,要你求A + A^2 + A^3 + A^4 + A^5.......A^k ...

  6. [Effective JavaScript 笔记]第34条:在原型中存储方法

    js中完全有可能不借助原型进行编程.不用在其原型中定义任何的方法. 创建对象 构造函数法 所有属性和方法都在构造函数中定义 function User(name,pwd){ this.name=nam ...

  7. 正则匹配之url的匹配

    通过这几天的学习,已经对正则有所了解了. 下面动手写一个匹配url的正则吧. <?php $str="http://www.baidu.com"; $reg="/( ...

  8. HDU1711

    Number Sequence Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. postgresql 函数demo

    create or replace function refresh_product_usage() returns void as $$ declare rec record; sub_rec re ...

  10. 63.如何对单链表进行快排?和数组快排的分析与对比[quicksort of array and linked list]

    [本文链接] http://www.cnblogs.com/hellogiser/p/quick-sort-of-array-and-linked-list.html [题目] 单链表的特点是:单向. ...