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. Media层

    媒体层包含图形技术.音频技术和视频技术,这些技术相互结合就可为移动设备带来最好的多媒体体验,更重要的是,它们让创建外观音效俱佳的应用程序变得更加容易.您可以使用iOS的高级框架更快速地创建高级的图形和 ...

  2. 在JAVA中 System.getProperty 和 System.setProperty 方法.

    今天着手研究TOMCAT源码. 在刚開始的时候Startup类中init方法中调用非常多次System.getProperty和System.setProperty的方法. 后来经过网上搜索才得知,这 ...

  3. OpenStack Neutron DVR L2 Agent的初步解析 (一)

    声明: 本博客欢迎转载,但请保留原作者信息! 作者:林凯 团队:华为杭州OpenStack团队 OpenStack Juno版本号已正式公布,这是这个开源云平台的10个版本号,在Juno版的Neutr ...

  4. 斐波那契数列(fabnacci)java实现

    斐波那契数列定义:From Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Fibonacci_number In math ...

  5. IntelliJIdea快捷键

    Ctrl+Shift+方向键Up/Down 代码向上/下移动. Ctrl+X 删除行 Ctrl+Y 也是删除行,不知道有啥区别 Ctrl+D 复制行 Ctrl+Alt+L 格式化代码 Ctrl+N 查 ...

  6. /etc/motd and /etc/issue

    /etc/motd and /etc/issue Bash offers an option to include messages in the /etc/motd and the /etc/iss ...

  7. hdu 2304

    题意: 插座插空问题 水题.....只要知道最后一个不需要插即可.... 直接贴代码.. AC代码: #include <iostream> using namespace std; in ...

  8. bootstrap初探2

    控制是否显示:visible-(lg | md | sm |sx)-(block | inline | inline-block), hidden-(lg | md | sm |sx) <!DO ...

  9. ajax请求在ie8下缓存问题

    我今天在改项目bug的时候,发现ajax请求在ie8下有缓存,在缓存过期之前,针对相同地址发起的多个Ajax请求,只有第一次会真正发送到服务端.在某些情况下,这种默认的缓存机制并不是我们希望的(比如获 ...

  10. apache的域名添加虚拟端口号

    1. vi /etc/httpd/conf/httpd.conf 2. 搜索Listen 80,在后面添加Listen 8080 3. 重启apache服务器./usr/sbin/apachectl ...