题解

94 条题解

  • 0
    @ 2009-05-29 03:08:23

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    #include

    #define WIDTH 4

    #define HEIGHT 3

    #define DEEPTH 2

    int m,n;

    char drawing[600][250];

    char pattern[6][7]= { {'+','-','-','-','+','.','.'},

    {'|',' ',' ',' ','|','/','.'},

    {'|',' ',' ',' ','|',' ','+'},

    {'+','-','-','-','+',' ','|'},

    {'.','/',' ',' ',' ','/','|'},

    {'.','.','+','-','-','-','+'} };

    void init_drawing()

    {

    int i,j;

    for(i=0;i

  • 0
    @ 2009-05-09 19:45:51

    我的BT程序

    Program Drawing;

    Const

    draw: Array [1..6, 1..7] Of Char = (('*','*','+','-','-','-','+'),

    ('*','/',' ',' ',' ','/','|'),

    ('+','-','-','-','+',' ','|'),

    ('|',' ',' ',' ','|',' ','+'),

    ('|',' ',' ',' ','|','/','*'),

    ('+','-','-','-','+','*','*'));

    Var

    max, maxx, maxy, m, n, i, j, k, x, y, px, py, x1, y1: Longint;

    ans: Array [1..1000, 1..1000] Of Char;

    a: Array [1..50, 1..50] Of Longint;

    Begin

    ReadLn(m, n);

    max := 0;

    For i:=1 To m Do Begin

    For j:=1 To n Do Begin

    Read(a[i, j]);

    If a[i, j]>max Then max := a[i, j];

    End;

    ReadLn;

    End;

    For i:=1 To 1000 Do

    For j:=1 To 1000 Do

    ans[i, j] := '.';

    maxx := 0;

    maxy := 0;

    For k:=1 To max Do

    For i:=1 To m Do

    For j:=1 To n Do

    If a[i, j]>=k Then Begin

    x := m - i + 1;

    y := j;

    px := 1 + (k-1) * 3 + (x-1) * 2;

    py := 1 + (y-1) * 4 + (x-1) * 2;

    If px>maxx Then maxx := px;

    If py>maxy Then maxy := py;

    For x1:=1 To 6 Do

    For y1:=1 To 7 Do

    If draw[x1, y1]'*' Then

    ans[px+6-x1, py+y1-1] := draw[x1, y1];

    End;

    For i:=maxx+5 Downto 1 Do Begin

    For j:=1 To maxy+6 Do

    Write(ans[i, j]);

    WriteLn;

    End;

    End.

  • 0
    @ 2009-04-24 21:53:11

    #include

    #include

    #define fill(dx,dy,str) memcpy(&gr[stx+(dx)][sty+(dy)],(str),strlen(str))

    int main(void) {

    int m,n;

    // freopen("drawing.in","r",stdin);

    scanf("%d%d",&m,&n);

    char a[m][n];

    int i,j,k=0,l,t;

    for(i=0;i

  • 0
    @ 2009-04-14 13:02:53

    使用立体图源程序得到的产物:

    (请复制到TXT或Pascal里面看,效果比较好)

    ................+---|+........

    .............../ /|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ..............| | +........

    ..............| |/|........

    ..............+---|+ |........

    ........+---|+-| | +---|+....

    ......./ / | |/ /|....

    ......+---|+---|+---|+---|+ |....

    ...../ / /| / /| +---|+

    ....+---|+---|+ | +---|+ |/ /|

    .../ / /| +/ /| +---|+ |

    ..+---|+---|+ |/+---|+ |/ /| +

    ..| | | + | | +---|+ |/.

    ..| | |/| | |/ /| +..

    ..+---|+---|+ |/+---|+---|+ |/...

    ..| | | +/ / /| +....

    ..| | |/+---|+---|+ |/.....

    ..+---|+---|+.| | | +......

    ............| | |/.......

    ............+---|+---|+........

    输入文件为:

    4 5

    2 2 9 2 1

    2 2 0 2 1

    2 2 0 2 1

    0 0 0 1 1

  • 0
    @ 2009-03-19 20:24:02

    Drawing 写烂了程序超出60行

    其实在Const中就可以把立方体写进去

    懒的改了

  • 0
    @ 2009-02-21 15:12:10

    var

    a:array[1..30,1..30] of integer;

    b:array[1..210,1..210] of char;

    m,n,i,j,k,maxh,maxl,temp:integer;

    procedure draw(i,j:integer);

    var

    k:integer;

    begin

    b:='+'; for k:=1 to 3 do b:='-'; b:='+';

    b:='/'; for k:=1 to 3 do b:=' '; b:='/'; b:='|';

    b:='+'; for k:=1 to 3 do b:='-'; b:='+'; b:=' '; b:='|';

    b:='|'; for k:=1 to 3 do b:=' '; b:='|'; b:=' '; b:='+';

    b:='|'; for k:=1 to 3 do b:=' '; b:='|'; b:='/';

    b:='+'; for k:=1 to 3 do b:='-'; b:='+';

    end;

    begin

    readln(m,n);

    for i:=1 to m do

    for j:=1 to n do

    read(a);

    maxh:=0; maxl:=0;

    for i:=1 to m do

    for j:=1 to n do

    if 3*(a)+3+2*(m-i)>maxh then maxh:=3*(a)+3+2*(m-i);

    for i:=1 to m do

    begin

    temp:=0;

    for j:=1 to n do

    if a>0 then temp:=temp+1;

    if (temp*4+3+2*(m-i))>maxl then maxl:=temp*4+3+2*(m-i);

    end;

    for i:=1 to maxh do

    for j:= 1 to maxl do

    b:='.';

    for i:=1 to m do

    for j:=1 to n do

    for k:=1 to a do

    draw(maxh-2*(m-i)-3*(k-1),4*(j-1)+2*(m-i)+1);

    for i:=1 to maxh do

    begin

    for j:=1 to maxl do

    write(b);

    writeln;

    end;

    readln;

    end.

  • 0
    @ 2009-02-05 15:09:24

    图的总长: l:= m*4+1 + n*2第i行,第j列的矩阵中填充的立方体数为a,则该格所需要的最小画布高度为: t:= a*3+1 + (n-i+1)*2;图的总高度为: h:= max( t )设当前的积木是第 i 行, 第 j 列 , 从下至上 第 k 个; 那当前积木左下角 "+" 的坐标(x,y) 为:x:= h- ( (n-i)*2 + (k-1)*3 ) y:= (j-1)*4 + (n-i)*2+1把整个背景全部变成 " . "最后 依照从后到前,从左到右,从下到上的顺序去覆盖 即可

    --------------庆祝第 152 个通过

  • 0
    @ 2009-02-04 09:40:39

    第150题 庆祝下… ^ ^ 可惜是第149个通过,差一点

    确定画布的长和宽

    依照从后到前,从左到右,从下到上的顺序去覆盖

    覆盖时先确定左下脚顶点,然后根据规则,纯熟训练打字……

    代码40行不到……

  • 0
    @ 2009-01-19 14:57:52

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

    基本上找到规律就行了,以前考试是做过这题

    一个一个的盖上去,从后面开始覆盖

  • 0
    @ 2009-01-16 20:56:29

    终于AC了!!!!!

  • 0
    @ 2009-01-16 20:17:12

    ....................+---|+...........+---|+---|+..

    .................../ /|........../ / /|..

    ..............+---|+---|+---|+...+---|+---|+---|+---|+

    ............./ /| / /|../ /| | / /|

    ............+---|+ | +---|+ |.+---|+ | | +---|+ |

    .........../ /| +/ /| +/ /| +---|+-| | +

    ..........+---|+---|+---|+ |/+---|+ |/......| |/.

    ........./ / / /| +/ /| +.......+---|+..

    ........+---|+---|+---|+ |/+---|+ |/...............

    ......./ /| / /| +/ /| +................

    ......+---|+ | +---|+ |/+---|+ |/.................

    ...../ /| +/ /| +/ /| +..................

    ....+---|+ |/+---|+ |/+---|+ |/....+---|+..........

    .../ /| +/ /| +/ /| +..../ /|..........

    ..+---|+ |/+---|+ |/+---|+---|+---|+---|+ |..........

    ./ /| +/ /| +.| / / /| | +..........

    +---|+ |/+---|+ |/..| +---|+---|+ | |/...........

    | | +.| | +...+-| | | +---|+............

    | |/..| |/......| | |/.................

    +---|+...+---|+.......+---|+---|+..................

  • 0
    @ 2009-01-15 22:08:05

    #include

    using namespace std;

    ifstream fin("drawing.in");

    ofstream fout("drawing.out");

    char ans[500][500];

    int m,n,t[50][50];

    int xall,yall;

    void cinit(){

    for (int i=0;im>>n;

    for (int i=0;it[i][j];

    if (t[i][j]>maxl) maxl=t[i][j];

    }

    maxl=maxl*3+(m-i-1)*2;

    if (maxl>tall) tall=maxl;

    }

    yall=n*4+m*2+1;

    xall=tall+3;

    }

    void drawone(int a,int b){//画一个立方体,其左下角坐标是a,b

    ans[a-5]='+'; ans[a-5]='-'; ans[a-5]='-'; ans[a-5]='-'; ans[a-5]='+';

    ans[a-4]='/'; ans[a-4]=' '; ans[a-4]=' '; ans[a-4]=' '; ans[a-4]='/'; ans[a-4]='|';

    ans[a-3]='+'; ans[a-3]='-'; ans[a-3]='-'; ans[a-3]='-'; ans[a-3]='+'; ans[a-3]=' '; ans[a-3]='|';

    ans[a-2]='|'; ans[a-2]=' '; ans[a-2]=' '; ans[a-2]=' '; ans[a-2]='|'; ans[a-2]=' '; ans[a-2]='+';

    ans[a-1]='|'; ans[a-1]=' '; ans[a-1]=' '; ans[a-1]=' '; ans[a-1]='|'; ans[a-1]='/';

    ans[a]='+'; ans[a]='-'; ans[a]='-'; ans[a]='-'; ans[a]='+';

    }

    void out(){

    for (int i=0;i

  • 0
    @ 2009-01-12 09:59:22

    先确定高度和宽度height=min{(M-I+1)*2+1+ a*3}(1

  • 0
    @ 2009-01-04 20:34:12

    一个个地画..

  • 0
    @ 2008-12-31 19:41:07

    const

    maxx=1000;

    maxy=1000;

    ch1=chr(43);

    ch2=chr(45);

    ch3=chr(47);

    ch4=chr(124);

    var

    m,n,h,i,j,k,a,b,maxh:longint;

    map:array [1..50,1..50,1..100] of boolean;

    s:array [1..maxx,1..maxy] of char;

    procedure draw(x,y:longint);

    var

    i:longint;

    begin

    s[x,y]:=ch1;

    for i:=1 to 3 do s[x,y+i]:=ch2;

    s[x,y+4]:=ch1;

    s[x+1,y]:=ch4;

    for i:=1 to 3 do s[x+1,y+i]:=' ';

    s[x+1,y+4]:=ch4;

    s[x+1,y+5]:=ch3;

    s[x+2,y]:=ch4;

    for i:=1 to 3 do s[x+2,y+i]:=' ';

    s[x+2,y+4]:=ch4;

    s[x+2,y+5]:=' ';

    s[x+2,y+6]:=ch1;

    s[x+3,y]:=ch1;

    for i:=1 to 3 do s[x+3,y+i]:=ch2;

    s[x+3,y+4]:=ch1;

    s[x+3,y+5]:=' ';

    s[x+3,y+6]:=ch4;

    s[x+4,y+1]:=ch3;

    for i:=2 to 4 do s[x+4,y+i]:=' ';

    s[x+4,y+5]:=ch3;

    s[x+4,y+6]:=ch4;

    s[x+5,y+2]:=ch1;

    for i:=3 to 5 do s[x+5,y+i]:=ch2;

    s[x+5,y+6]:=ch1;

    if x+5>a then a:=x+5;

    if y+6>b then b:=y+6;

    end;

    begin

    a:=0;

    b:=0;

    maxh:=0;

    fillchar(map,sizeof(map),false);

    fillchar(s,sizeof(s),chr(46));

    readln(m,n);

    for i:=1 to m do

    begin

    for j:=1 to n do

    begin

    read(h);

    for k:=1 to h do map:=true;

    if h>maxh then maxh:=h;

    end;

    readln;

    end;

    for i:=1 to maxh do for j:=1 to m do for k:=1 to n do if map[j,k,i] then draw(i*3+(m-j)*2-2,k*4+(m-j)*2-3);

    for i:=a downto 1 do

    begin

    for j:=1 to b do write(s);

    writeln;

    end;

    end.

  • 0
    @ 2008-12-30 21:51:41

    第五十八个ac,58——好吉利~~~~~~

    program o1;

    var minh,minl,max,k,n,m,i,j,h,l,maxh,maxl:integer;

    a:array[1..50,1..50] of integer;

    p:array[-304..304,-304..304] of char;

    begin

    readln(n,m);

    fillchar(p,sizeof(p),'.');

    for i:=1 to n do

    for j:=1 to m do

    begin read(a);if (i=1) and (a>max) then max:=a;end;

    max:=max*3+3;

    minh:=1;minl:=1;

    for i:=1 to n do

    for j:=1 to m do

    begin

    h:=max+(i-1)*2;l:=4*j+1+(n-i)*2;

    if h>maxh then maxh:=h;

    if l>maxl then maxl:=l;

    if l-4

  • 0
    @ 2008-12-29 20:47:43

    做这题目实在太令我兴奋了

    main code:

    for i:=1 to n do

    for j:=1 to m do

    for g:=1 to a do

    begin

    i1:=k-(n-i)*2-3*(g-1);

    j1:=1+(n-i)*2+(j-1)*4;

    f[i1,j1]:='+';f[i1,j1+1]:='-';f[i1,j1+2]:='-';f[i1,j1+3]:='-';f[i1,j1+4]:='+';

    f[i1-1,j1]:='|';f[i1-1,j1+1]:=' ';f[i1-1,j1+2]:=' ';f[i1-1,j1+3]:=' ';f[i1-1,j1+4]:='|';f[i1-1,j1+5]:='/';

    f[i1-2,j1]:='|';f[i1-2,j1+1]:=' ';f[i1-2,j1+2]:=' ';f[i1-2,j1+3]:=' ';f[i1-2,j1+4]:='|';f[i1-2,j1+5]:=' ';f[i1-2,j1+6]:='+';

    f[i1-3,j1]:='+';f[i1-3,j1+1]:='-';f[i1-3,j1+2]:='-';f[i1-3,j1+3]:='-';f[i1-3,j1+4]:='+';f[i1-3,j1+5]:=' ';f[i1-3,j1+6]:='|';

    f[i1-4,j1+1]:='/';f[i1-4,j1+2]:=' ';f[i1-4,j1+3]:=' ';f[i1-4,j1+4]:=' ';f[i1-4,j1+5]:='/';f[i1-4,j1+6]:='|';

    f[i1-5,j1+2]:='+';f[i1-5,j1+3]:='-';f[i1-5,j1+4]:='-';f[i1-5,j1+5]:='-';f[i1-5,j1+6]:='+';

    end;

  • 0
    @ 2008-12-29 19:28:49

    传说中的5重循环……

    Const

    ma:array[1..6,1..7] of char=(('#','#','+','-','-','-','+'),

    ('#','/',' ',' ',' ','/','|'),

    ('+','-','-','-','+',' ','|'),

    ('|',' ',' ',' ','|',' ','+'),

    ('|',' ',' ',' ','|','/','#'),

    ('+','-','-','-','+','#','#'));

    Var

    cord1,cord2,max1,max2,m,n,i,j,k,kkk1,kkk2,s1,s2:integer;

    re:array[1..50,1..50] of integer;

    ans:array[1..201,1..201] of char;

    bool:boolean;

    Begin

    for i:=1 to 201 do

    for j:=1 to 201 do ans:='.';

    readln(m,n);

    for i:=1 to m do

    begin

    for j:=1 to n do

    begin

    read(re);

    if re>max1 then max1:=re;

    end;

    readln;

    end;

    max1:=max1*3+1;

    for i:=1 to m do

    begin

    for j:=1 to n do

    begin

    s2:=2*(m-i)+4*(j-1)+1;

    for k:=1 to re do

    begin

    s1:=max1-3*k;

    for kkk1:=1 to 6 do

    for kkk2:=1 to 7 do

    if ma[kkk1,kkk2]'#' then ans[s1+kkk1-1,s2+kkk2-1]:=ma[kkk1,kkk2];

    end;

    end;

    max1:=max1+2;

    end;

    i:=0;

    repeat

    inc(i);

    j:=1;

    while (ans='.') and (j

  • 0
    @ 2008-12-29 18:31:47

    传说中的模拟。。。通过数学方法找到顶点就不难了。。。。

    //1>>+

    //2>>|

    //3>>-

    //4>>/

    //5>>nothing

    //0>>.

    #include "stdio.h"

    #include "Stdlib.h"

    char dir[7]=".+|-/ ";

    int data[1000][1000],map[1000][1000]={0},high,wide;

    void print(){

    int i,j;

    for(i=1;i

  • 0
    @ 2008-12-28 00:34:17

    巨大的模拟!!!

    在画布(二维数组)上绘制,算出立方体左下角的坐标,然后从左上角绘制到右下角,每个点从下向上绘制(Paint过程用于绘制一个立方体)

    注意:立方体每个面中间空白的部分一定要用空格填上!

    program drawing;

    var

    G:array[1..1024,1..1024]of char;

    m,n,i,j,k,Height,x,y,Max_x,Max_y:longint;

    function Max(const x,y:longint):longint;

    begin

    if x>y then exit(x)

    else exit(y);

    end;

    procedure Paint(const x,y:longint);

    begin

    Max_x:=Max(Max_x,x+6);

    Max_y:=Max(Max_y,y+5);

    //////////////////////////////////////////

    G[y,x]:='+';

    G[y,x+4]:='+';

    G[y+3,x]:='+';

    G[y+3,x+4]:='+';

    G[y+5,x+2]:='+';

    G[y+5,x+6]:='+';

    G[y+2,x+6]:='+';

    //////////////////////////////////////////

    G[y,x+1]:='-';

    G[y,x+2]:='-';

    G[y,x+3]:='-';

    G[y+3,x+1]:='-';

    G[y+3,x+2]:='-';

    G[y+3,x+3]:='-';

    G[y+5,x+3]:='-';

    G[y+5,x+4]:='-';

    G[y+5,x+5]:='-';

    //////////////////////////////////////////

    G[y+1,x]:='|';

    G[y+2,x]:='|';

    G[y+1,x+4]:='|';

    G[y+2,x+4]:='|';

    G[y+3,x+6]:='|';

    G[y+4,x+6]:='|';

    //////////////////////////////////////////

    G[y+4,x+1]:='/';

    G[y+1,x+5]:='/';

    G[y+4,x+5]:='/';

    //////////////////////////////////////////

    G[y+2,x+1]:=' ';

    G[y+2,x+2]:=' ';

    G[y+2,x+3]:=' ';

    G[y+1,x+1]:=' ';

    G[y+1,x+2]:=' ';

    G[y+1,x+3]:=' ';

    G[y+4,x+2]:=' ';

    G[y+4,x+3]:=' ';

    G[y+4,x+4]:=' ';

    G[y+3,x+5]:=' ';

    G[y+2,x+5]:=' ';

    end;

    begin

    readln(m,n);

    fillchar(G,sizeof(G),'.');

    for i:=m downto 1 do

    for j:=1 to n do

    begin

    read(Height);

    y:=2*i-1;

    x:=j*4-3+y-1;

    for k:=1 to Height do

    begin

    Paint(x,y);

    inc(y,3);

    end;

    end;

    for i:=Max_y downto 1 do

    begin

    for j:=1 to Max_x do

    write(G);

    writeln;

    end;

    end.

信息

ID
1497
难度
2
分类
字符串 | 模拟 点击显示
标签
递交数
1932
已通过
1120
通过率
58%
被复制
18
上传者