题解

61 条题解

  • 0
    @ 2009-10-21 12:48:49

    简单的模拟。

    直接构造。

  • 0
    @ 2009-10-15 16:11:44
  • 0
    @ 2009-10-15 16:07:15

    我们人工到了9,10的最后几行编译器成不下了……

    Orz zzq同学!!

  • 0
    @ 2009-10-06 10:31:13

    相当无语

    原来输出的时候是

    if a='' then write(' ');

    0分

    后来在开始的地方

    fillchar(a,sizeof(a),' ');

    100分……

    为什么啊……

    做法是生成1de

    然后平移3次

    一直循环下去

  • 0
    @ 2009-09-25 01:19:34

    祝贺一下,一次AC!

    #include

    char answer[5000][5000]={};

    int number,w[12]={1,2,4,8,16,32,64,128,256,512,1024,2048};

    void work(int i,int j,int size)

    {

    if(size==1)

    {

    answer[i][j+1]=answer[j]='/';

    answer[i][j+2]=answer[j+3]='\';

    answer[j+1]=answer[j+2]='_';

    return;

    }

    else

    {

    work(i,j+w,size-1);

    work(i+w,j,size-1);

    work(i+w,j+w,size-1);

    }

    }

    main()

    {

    int i,j;

    scanf("%d",&number);

    work(0,0,number);

    for(i=0;i

  • 0
    @ 2009-09-15 17:58:47

    七十题纪念!!!!!!!!!!!!!!!

    program nanman;

    var a:array [1..10000,1..10000] of char;

    i,j,z,x,y,n:longint;

    begin

    fillchar(a,sizeof(a),' ');

    readln(n);

    a[1,1]:='/';

    a[2,2]:='/';

    a[2,1]:='_';

    a[3,1]:='_';

    a[4,1]:='\';

    a[3,2]:='\';

    x:=4; y:=2;

    for i:=2 to n do

    begin

    for j:=1 to y do

    for z:=1 to x do

    begin

    a[z+y,j+y]:=a[z,j];

    a[x+z,j]:=a[z,j];

    end;

    x:=x*2;

    y:=y*2;

    end;

    for i:=y downto 1 do

    begin

    for j:=1 to x do write(a[j,i]);

    writeln;

    end;

    end.

  • 0
    @ 2009-09-04 16:43:45

    program ex_1167;

    var

    a,b:array[1..2000,1..2000]of char;

    x:array[1..12]of longint;

    i,j,m,n,s,k,l:longint;

    t:char;

    begin

    read(n);

    x[1]:=2;

    for i:=2 to 10 do

    x[i]:=x*2;

    s:=0;

    fillchar(b,sizeof(b),' ');

    fillchar(a,sizeof(a),' ');

    repeat

    s:=s+1;

    if s=1 then

    begin

    a[1,2]:='/';

    a[1,3]:='\';

    a[2,1]:='/';

    a[2,2]:='_';

    a[2,3]:='_';

    a[2,4]:='\';

    end

    else

    begin

    for i:=1 to x do

    for j:=1 to x do

    if a' ' then

    begin

    b[i,j+x]:=a;

    b[i+x,j]:=a;

    b[i+x,j+x]:=a;

    end;

    a:=b;

    fillchar(b,sizeof(b),' ');

    end;

    until s=n;

    for i:=1 to x[n] do

    begin

    for j:=1 to x[n+1] do

    write(a);

    writeln;

    end;

    end.

  • 0
    @ 2009-08-28 14:45:22

    交了三次,终于通过了。我已经有点冲动了。

    我在做的时候没有把整个存图形的数组fillchar成空格,只是在输出的时候判断如果=''就输出' ',结果这个自己运行可以,可是交上去前四个数据输出比正确答案长,最后一个数据错误。我恼火了,就fillchar了一下。结果就过了。心寒啊。

    不用考虑输出样例里最后一行缺少回车,就算你输出了也是对的。

    我的做法是:用递归做。

    先定义数组er,er[i]:=二的 i 次方。(这个数组一定要做,后面递归也有用到。)

    递归从(er[n],1,n)开始,前面两个是三角形左下角坐标,最后一个是大小。

    递归开始,如果第三个数等于1,就在该坐标上画出一个单位三角形。否则,递归三次,分别递归同一个位置、右边、上面的这三个三角形,大小比原来小1。

    另外我很无趣地输出了个大小为10的三角形,输出文件1M多。想打表的同学做好心理准备,

  • 0
    @ 2009-08-16 15:39:22

    湖南人民发来贺电 庆贺黄大牛同学人工到了6..

  • 0
    @ 2009-08-16 11:20:06

    var

    n:longint;

    begin

    assign(input,'a3.in');

    assign(output,'a3.out');

    reset(input);

    rewrite(output);

    readln(n);

    if n=1 then

    begin

    writeln(' /\');

    writeln('/__\');

    end;

    if n=2 then

    begin

    writeln(' /\');

    writeln(' /__\');

    writeln(' /\ /\');

    writeln('/__\/__\');

    end;

    if n=3 then

    begin

    writeln(' /\');

    writeln(' /__\');

    writeln(' /\ /\');

    writeln(' /__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln('/__\/__\/__\/__\');

    end;

    if n=4 then

    begin

    writeln(' /\');

    writeln(' /__\');

    writeln(' /\ /\');

    writeln(' /__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln('/__\/__\/__\/__\/__\/__\/__\/__\');

    end;

    if n=5 then

    begin

    writeln(' /\');

    writeln(' /__\');

    writeln(' /\ /\');

    writeln(' /__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\/__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\ /__\/__\/__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\ /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln('/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\');

    end;

    if n=6 then

    begin

    writeln(' /\');

    writeln(' /__\');

    writeln(' /\ /\');

    writeln(' /__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\/__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\ /__\/__\/__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\ /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\');

    writeln(' /\ /\');

    writeln(' /__\ /__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\ /__\/__\/__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\ /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\/__\/__\/__\/__\ /__\/__\/__\/__\/__\/__\/__\/__\');

    writeln(' /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\ /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\/__\/__\ /__\/__\/__\/__\ /__\/__\/__\/__\ /__\/__\/__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\/__\ /__\/__\ /__\/__\ /__\/__\ /__\/__\ /__\/__\ /__\/__\ /__\/__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln(' /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\');

    writeln(' /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\');

    writeln('/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\');

    end;

    close(input);

    close(output);

    end.

    谁能继承我的事业啊!

    我快疯了!

    80分

    赌中最后一个算你狠!!!!

  • 0
    @ 2009-08-10 22:00:51

    各位大牛的方法实在太神奇了~~

    利用数组记录,比我的递归好多了~~

    ps:楼下的程序有问题......最后应该是1-l to l的循环才对啊

  • 0
    @ 2009-08-07 11:59:04

    var

    n,i,l,h,x,y:integer;

    f:array[1..2000,-2000..2000] of char;

    begin

    fillchar(f,sizeof(f),' ');

    readln(n);

    f[1,0]:='/';

    f[1,1]:='\';

    f[2,-1]:='/';

    f[2,0]:='_';

    f[2,1]:='_';

    f[2,2]:='\';

    l:=2;

    h:=2;

    for i:= 2 to n do

    begin

    for x:= 1 to h do

    for y:= 1-l to l do

    begin

    f[h+x,y-l]:=f[x,y];

    f[h+x,y+l]:=f[x,y];

    end;

    l:=2*l;

    h:=2*h;

    end;

    for x:= 1 to h do

    begin

    for y:= -l to l do

    begin

    write(f[x,y]);

    end;

    writeln;

    end;

    end.

  • 0
    @ 2009-08-06 21:47:49

    n

  • 0
    @ 2009-08-04 13:20:58

    我递归太弱了 。。建议一开始先将全图给成空格,这样就不用考虑空格

  • 0
    @ 2009-08-01 14:52:29

    我是用分治做的,写一个函数叫draw(x,y,l)表示以(x,y)为左下角画一个大小为l的三角形,如果l等于1就直接画出来,否则的话就递归调用draw函数,画组成这个三角形的三个小三角形。

    这样整个main()里面就只有一个draw(x,y,n)了,(x,y要算一下是多大)

  • 0
    @ 2009-08-01 02:28:17

    囧了……为什么我就没想到扩展到负数咧……害得我正数搞半天……

    Orz楼下……

  • 0
    @ 2009-07-30 15:45:10

    var n,i,l,h,x,y:integer;

    f:array[1..2000,-2000..2000] of char;

    begin

    fillchar(f,sizeof(f),' ');

    readln(n);

    f[1,0]:='/';

    f[1,1]:='\';

    f[2,-1]:='/';

    f[2,0]:='_';

    f[2,1]:='_';

    f[2,2]:='\';

    l:=2;

    h:=2;

    for i:= 2 to n do

    begin

    for x:= 1 to h do

    for y:= 1-l to l do

    begin

    f[h+x,y-l]:=f[x,y];

    f[h+x,y+l]:=f[x,y];

    end;

    l:=2*l;

    h:=2*h;

    end;

    for x:= 1 to h do

    begin

    for y:= -l to l do

    begin

    write(f[x,y]);

    end;

    writeln;

    end;

    end.

    /\

    /__\

    /\ /\

    /__\/__\

    /\ /\

    /__\ /__\

    /\ /\ /\ /\

    /__\/__\/__\/__\

    /\ /\

    /__\ /__\

    /\ /\ /\ /\

    /__\/__\ /__\/__\

    /\ /\ /\ /\

    /__\ /__\ /__\ /__\

    /\ /\ /\ /\ /\ /\ /\ /\

    /__\/__\/__\/__\/__\/__\/__\/__\

    /\ /\

    /__\ /__\

    /\ /\ /\ /\

    /__\/__\ /__\/__\

    /\ /\ /\ /\

    /__\ /__\ /__\ /__\

    /\ /\ /\ /\ /\ /\ /\ /\

    /__\/__\/__\/__\ /__\/__\/__\/__\

    /\ /\ /\ /\

    /__\ /__\ /__\ /__\

    /\ /\ /\ /\ /\ /\ /\ /\

    /__\/__\ /__\/__\ /__\/__\ /__\/__\

    /\ /\ /\ /\ /\ /\ /\ /\

    /__\ /__\ /__\ /__\ /__\ /__\ /__\ /__\

    /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\

    /__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\/__\

  • 0
    @ 2009-07-27 09:19:33

    zyhzyhzyh是江湖大骗子,它程序有两处多添了一个1,还多加了两个readln,大家千万别上当。

  • 0
    @ 2009-07-27 09:09:57

    var n,i,j,k,x:longint;

    a:array[0..4000,0..4000]of char;

    function ji2(n:longint):longint;

    var sum,i:longint;

    begin

    sum:=1;

    for i:=1 to n do

    sum:=sum*2;

    ji2:=sum;

    end;

    begin

    readln;

    readln;

    fillchar(a,sizeof(a),' ');

    readln(n);

    a[1,2]:='/';a[1,3]:='\';

    a[2,2]:='_';a[2,3]:='_';

    a[2,1]:='/';a[2,4]:='\';

    for k:=2 to 1n do

    begin

    for i:=ji2(k-1)+1 to ji2(k) do

    for j:=1 to ji2(k) do

    a:=a;

    for i:=ji2(k-1)+1 to ji2(k) do

    for j:=ji2(k)+1 to ji2(k)*2 do

    a:=a;

    for i:=1 to ji2(k-1) do

    for j:=1 to ji2(k) do

    a:=' ';

    for i:=1 to 1ji2(k-1) do

    for j:=ji2(k-1)+1 to ji2(k-1)*3 do

    a:=a;

    end;

    for i:=1 to ji2(n) do

    begin

    for j:=1 to ji2(n)+i do

    write(a);

    if iji2(n) then write(' ');

    if iji2(n) then

    writeln;

    end;

    end.

  • 0
    @ 2009-07-25 12:53:08

    program p1167;

    var n,i,j,k,x:longint;

    a:array[0..4000,0..4000]of char;

    function ji2(n:longint):longint;

    var sum,i:longint;

    begin

    sum:=1;

    for i:=1 to n do

    sum:=sum*2;

    ji2:=sum;

    end;

    begin

    fillchar(a,sizeof(a),' ');{注意}

    readln(n);

    a[1,2]:='/';a[1,3]:='\';

    a[2,2]:='_';a[2,3]:='_';

    a[2,1]:='/';a[2,4]:='\';

    for k:=2 to n do

    begin

    for i:=ji2(k-1)+1 to ji2(k) do

    for j:=1 to ji2(k) do

    a:=a;

    for i:=ji2(k-1)+1 to ji2(k) do

    for j:=ji2(k)+1 to ji2(k)*2 do

    a:=a;

    for i:=1 to ji2(k-1) do

    for j:=1 to ji2(k) do

    a:=' ';

    for i:=1 to ji2(k-1) do

    for j:=ji2(k-1)+1 to ji2(k-1)*3 do

    a:=a;

    end;

    for i:=1 to ji2(n) do

    begin

    for j:=1 to ji2(n)+i do

    write(a);

    if iji2(n) then write(' ');

    if iji2(n) then

    writeln;

    end;

    end.

信息

ID
1167
难度
3
分类
模拟 点击显示
标签
递交数
1272
已通过
647
通过率
51%
被复制
9
上传者