C. Cardiogram
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

In this problem, your task is to use ASCII graphics to paint a cardiogram.

A cardiogram is a polyline with the following corners:

That is, a cardiogram is fully defined by a sequence of positive integers a1, a2, ..., an.

Your task is to paint a cardiogram by given sequence ai.

Input

The first line contains integer n (2 ≤ n ≤ 1000). The next line contains the sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 1000). It is guaranteed that the sum of all ai doesn't exceed 1000.

Output

Print max |yi - yj| lines (where yk is the y coordinate of the k-th point of the polyline), in each line print  characters. Each character must equal either « / » (slash), « \ » (backslash), « » (space). The printed image must be the image of the given polyline. Please study the test samples for better understanding of how to print a cardiogram.

Note that in this problem the checker checks your answer taking spaces into consideration. Do not print any extra characters. Remember that the wrong answer to the first pretest doesn't give you a penalty.

Sample test(s)
input
5
3 1 2 5 1
output
      / \
 / \ /  \
 /  \
 /  \
\ / 
input
3
1 5 1
output
 / \
\
\
\
\ / 
Note

Due to the technical reasons the answers for the samples cannot be copied from the statement. We've attached two text documents with the answers below.

http://assets.codeforces.com/rounds/435/1.txt

http://assets.codeforces.com/rounds/435/2.txt

又一模拟题。。。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#define ll long long
#define inf 0x7fffffff
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x*=10;x+=ch-'0';ch=getchar();}
return x*f;
}
int n,tot,mx=1000,mn=1000,x,y=1000;
int a[1005];
int b[2005][2005];
int main()
{
n=read();
for(int i=1;i<=n;i++)
a[i]=read(),tot+=a[i];
for(int i=1;i<=n;i++)
{
x++;
if(i&1)
{
a[i]--;
b[x][y]=1;
while(a[i]--)
{
x++;y++;
b[x][y]=1;
}
mx=max(mx,y);
}
else
{
a[i]--;
b[x][y]=2;
while(a[i]--)
{
x++;y--;
b[x][y]=2;
}
mn=min(mn,y);
}
}
for(int i=mx;i>=mn;i--)
{
for(int j=1;j<=tot;j++)
if(b[j][i]==1)printf("/");
else if(b[j][i]==2)printf("\\");
else printf(" ");
printf("\n");
}
return 0;
}

cf435C Cardiogram的更多相关文章

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

    题目地址:http://codeforces.com/contest/435/problem/C /* 题意:给一组公式,一组数据,计算得到一系列的坐标点,画出折线图:) 模拟题:蛮恶心的,不过也简单 ...

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

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

  3. 【奶昔队ROUND#1】

    奶昔队Round #1 热身 (奶昔队不是真正的队,是群) CodeForces 435C Cardiogram 模拟,不过我做的时候不是模拟,是计算...(写了好久,还wa了几次),现在看了别人的代 ...

  4. 2015.05.15,外语,学习笔记-《Word Power Made Easy》 02 “如何谈论医生”

    包括Sessions 4-6: Prefix Person,nous,etc. Practice,etc. Adjective internus内部 internist [ɪn'tɝnɪst] n.内 ...

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

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

随机推荐

  1. 装多版本号sqlserver的远程连接问题

    装系统时win7下一直没法装sqlserver2012,后来装了sqlserver2005,前段时间因须要使用sqlserver2012,尝试再装一次,居然装成功了.但是sqlserver2012远程 ...

  2. sqlcipher移植

    一.下载代码 sqlcipher赖openssl库,首先下载openssl: [fulinux@ubuntu ~]$ git clone https://github.com/openssl/open ...

  3. Java基础知识强化92:日期工具类的编写和测试案例

    1. DateUtil.java,代码如下: package cn.itcast_04; import java.text.ParseException; import java.text.Simpl ...

  4. 5、第5节课CSS补充和html 标签讲解20150924

    1. DIV 隐藏 A: 隐藏之后不占位置  display:none; B:隐藏之后占位置 visibility:hidden; 2.DIV 排序 z-index:2;  默认是1,如果想DIV在上 ...

  5. ImageIO.wtrie生成jpg图片质量损失方案:BufferedImage生成jpg图片文件流

    Iterator<ImageWriter> iterator = ImageIO.getImageWritersByFormatName("jpeg"); ImageW ...

  6. MySQL TEXT数据类型的最大长度

    TINYTEXT 256 bytes   TEXT 65,535 bytes ~64kb MEDIUMTEXT  16,777,215 bytes ~16MB LONGTEXT 4,294,967,2 ...

  7. 使用URL读取网络图片资源

    URL(Uniform Resource Locator) 对象代表统一资源定位器. 代码如下: public class MainActivity extends ActionBarActivity ...

  8. 武汉科技大学ACM :1010: 零起点学算法103——一只小蜜蜂...

    Problem Description 有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行.请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数. 其中,蜂房的结构如下所示. Input 输入数据的第一 ...

  9. 写一个“标准”宏MIN,这个宏输入两个参数并返回较小的一个。

    #define  MIN(A,B)   ((A)<=(B)?(A):(B))

  10. Linux编程基础——GDB(设置断点)(转:TianFang,cnblog: http://www.cnblogs.com/TianFang/archive/2013/01/20/2868889.html)

    启动GDB后,首先就是要设置断点,程序中断后才能调试.在gdb中,断点通常有三种形式: 断点(BreakPoint): 在代码的指定位置中断,这个是我们用得最多的一种.设置断点的命令是break,它通 ...