题目地址: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. DEDECMS网站数据备份还原教程

    备份织梦网站数据 dedecms备份教程 进入DedeCms后台 -> 系统 -> 数据库备份/还原 备份文件在\data\backupdata 下载数据库备份资料\data\backup ...

  2. DLL注入之注册表

    0x00 唠叨 编写本系列文章纯属为了系统学习DLL注入的方法,所以很多方法可能已经过时,希望各位看官勿喷.当然若有更好的方法,希望不腻赐教.若本文有任何错的地方,也希望各位指正.谢谢! 0x01 适 ...

  3. git初学者这样就行了。

    Create a new repository on the command line touch README.md git init git add README.md git commit -m ...

  4. Django authentication 使用方法

    转自 : https://docs.djangoproject.com/en/1.8/topics/auth/customizing/

  5. 【Docker】来自官方映像的 6 个 Dockerfile 技巧

    本文将根据我从官方镜像学到的经验,讲解编写Dockerfile的技巧.   1. 选择Debian  官方镜像的大多数Dockerfile,不管是直接还是通过其他镜像,都是基于Debian的.Dock ...

  6. 【Python】使用 boto 调用 S3 对象存储API

    代码示例: import logging #from django.conf import settings import boto from boto.s3.key import Key impor ...

  7. ajax:post 400错误

    POST http://localhost:8080/purchase/purchase-apply/update.htm 400 (Bad Request) n.ajaxTransport.k.co ...

  8. static-const 类成员变量

    [本文链接] http://www.cnblogs.com/hellogiser/p/static-const.html [分析] const数据成员必须在构造函数初始化列表中初始化; static数 ...

  9. IE8 不支持html5 placeholder的解决方案

    IE8不支持html5 placeholder的解决方法. /** * jQuery EnPlaceholder plug * version 1.0 2014.07.01戈志刚 * by Frans ...

  10. LLVM,Clang

    在使用xcode时常常会遇到这2个概念,今天总结一下. wiki中关于llvm的描述: LLVM提供了完整編譯系統的中間層,它會將中間語言(IF, Intermediate form)從編譯器取出與最 ...