必威体育Betway必威体育官网
当前位置:首页 > IT技术

永远的“超级玛丽游戏”(洛谷)

时间:2019-09-07 07:11:04来源:IT技术作者:seo实验室小编阅读:86次「手机版」
 

永远的超级玛丽

最近闲的蛋疼,来科普一道非常困难 简单的题目:超级玛丽游戏。不知道是哪个SB 大佬出的题目,打的我手都快废了,啊啊啊啊啊,下面,让我们来认真的学习一下这道题目。

先发个福利:超级玛丽

解法1:

#include<stdio.h>
int main() {
    printf(
    "                ********\n"
    "               ************\n"
    "               ####....#.\n"
    "             #..###.....##....\n"
    "             ###.......######              ###            ###\n"
    "                ...........               #...#          #...#\n"
    "               ##*#######                 #.#.#          #.#.#\n"
    "            ####*******######             #.#.#          #.#.#\n"
    "           ...#***.****.*###....          #...#          #...#\n"
    "           ....**********##.....           ###            ###\n"
    "           ....****    *****....\n"
    "             ####        ####\n"
    "           ######        ######\n"
    "##############################################################\n"
    "#...#......#.##...#......#.##...#......#.##------------------#\n"
    "###########################################------------------#\n"
    "#..#....#....##..#....#....##..#....#....#####################\n"
    "##########################################    #----------#\n"
    "#.....#......##.....#......##.....#......#    #----------#\n"
    "##########################################    #----------#\n"
    "#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n"
    "##########################################    ############\n"
    );
    return 0;
}   //本蒟蒻手打的,虽然通过了,但是真的手快断了,cry......

下面来欣赏一下大佬们的优秀 鬼畜做法。

解法2:

#include <bits/stdc++.h>
using namespace std;
int mp[100][100];
int last[100];
int n = 22, m = 62;
// 在[x1-x2, y1-y2]绘制ch
void draw(int x1, int y1, int x2, int y2, char ch = '#'){
    for(int i = x1; i <= x2; i++)
        for(int j = y1; j <= y2; j++)
            mp[i][j] = ch;
}
// 在[x1, y1]绘制ch
void draw(int x1, int y1, char ch = '#'){
    draw(x1, y1, x1, y1, ch);
}
// 以[x, y]为左上角绘制泥土
void drawland(int x, int y){
    draw(x, y, x+8, y+13);
    for(int i = x+1; i < x+8; i+=2)
        draw(i, y+1, i, y+12, '.');
    draw(x+1, y+4); draw(x+1, y+11);
    draw(x+3, y+3); draw(x+3, y+8);
    draw(x+5, y+6); draw(x+7, y+2);
    draw(x+7, y+5); draw(x+7, y+10);
}
// 以[x, y]为左上角绘制小岛
void drawisland(int x, int y){
    draw(x, y, x+3, y+19);
    draw(x+1, y+1, x+2, y+18, '-');
    draw(x+4, y+4, x+8, y+15);
    draw(x+4, y+5, x+7, y+14, '-');
}
// 以[x, y]为左上角绘制金币
void drawcoin(int x, int y){
    draw(x, y, x+5, y+4);
    draw(x+1, y+1, x+4, y+3, '.');
    draw(x+2, y+2, x+3, y+2);
    draw(x, y, ' '); draw(x+5, y, ' ');
    draw(x, y+4, ' '); draw(x+5, y+4, ' ');
}
// 以[x, y]为左上角绘制马里奥
void drawman(int x, int y){
    draw(x, y+5, x, y+12, '*'); x++;
    draw(x, y+4, x, y+15, '*'); x++;
    draw(x, y+4, x, y+7); draw(x, y+8, x, y+13, '.'); draw(x, y+12); x++;
    draw(x, y+2, x, y+14); draw(x, y+3, x, y+4, '.');
    draw(x, y+8, x, y+12, '.'); draw(x, y+15, x, y+18, '.'); x++;
    draw(x, y+2, x, y+17); draw(x, y+5, x, y+11, '.'); x++;
    draw(x, y+5, x, y+15, '.'); x++;
    draw(x, y+4, x, y+13); draw(x, y+6, '*'); x++;
    draw(x, y+1, x, y+17); draw(x, y+5, x, y+11, '*'); x++;
    draw(x, y, x+2, y+20, '.'); draw(x, y+4, x+2, y+16, '*');
    draw(x, y+3); draw(x, y+14, x+1, y+16); draw(x+1, y+16, '.');
    draw(x+2, y+8, x+2, y+11, ' '); draw(x, y+7, '.'); draw(x, y+12, '.');
    draw(x+3, y, x+4, y+19); draw(x+3, y+6, x+4, y+13, ' ');
    draw(x+3, y, x+3, y+1, ' '); draw(x+3, y+18, x+3, y+19, ' ');
}
// 打印输出
void printscreen(){
    for(int i = 1; i <= n; i++){
        last[i] = m;
        while(mp[i][last[i]] == ' ')
            last[i]--;
    }
    for(int i = 1; i <= n; i++,puts(""))
        for(int j = 1; j <= last[i]; j++)
            putchar(mp[i][j]);
}
int main(){
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            mp[i][j] = ' ';
    // 绘制人
    drawman(1, 12);
    // 绘制他脚下的三块泥土
    drawland(14, 1); drawland(14, 15); drawland(14, 29);
    // 绘制金币下面的那个岛屿
    drawisland(14, 43);
    // 绘制两个金币
    drawcoin(5, 43); drawcoin(5, 58);
    // 输出
    printscreen();
    return 0;
}

解法3:

#include<iOStream>
int main()
{
    std::cout<<R"(                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############ )";
}  //这个毒瘤的大佬使用了一种神奇的技术: C++11 raw string literal 技术,让你体会复制粘贴的恐惧

解法4(C#):

using System;
namespace Luogu
{
    class Algo{
        public static void Main()
        {
            console.Write(@"                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############");
        }
    }
}

解法5(Python):

print("""                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############""")

解法6(pascal):

    begin
    writeln('                ********');
    writeln('               ************');
    writeln('               ####....#.');
    writeln('             #..###.....##....');
    writeln('             ###.......######              ###            ###');
    writeln('                ...........               #...#          #...#');
    writeln('               ##*#######                 #.#.#          #.#.#');
    writeln('            ####*******######             #.#.#          #.#.#');
    writeln('           ...#***.****.*###....          #...#          #...#');
    writeln('           ....**********##.....           ###            ###');
    writeln('           ....****    *****....');
    writeln('             ####        ####');
    writeln('           ######        ######');
    writeln('##############################################################');
    writeln('#...#......#.##...#......#.##...#......#.##------------------#');
    writeln('###########################################------------------#');
    writeln('#..#....#....##..#....#....##..#....#....#####################');
    writeln('##########################################    #----------#');
    writeln('#.....#......##.....#......##.....#......#    #----------#');
    writeln('##########################################    #----------#');
    writeln('#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#');
    writeln('##########################################    ############');
end.

解法7:

#include<stdio.h>
int main()
{
 printf("                ********\n");
 printf("               ************\n");
 printf("               ####....#.\n");
 printf("             #..###.....##....\n");
 printf("             ###.......######              ###            ###\n");
 printf("                ...........               #...#          #...#\n");
 printf("               ##*#######                 #.#.#          #.#.#\n");
 printf("            ####*******######             #.#.#          #.#.#\n");
 printf("           ...#***.****.*###....          #...#          #...#\n");
 printf("           ....**********##.....           ###            ###\n");
 printf("           ....****    *****....\n");
 printf("             ####        ####\n");
 printf("           ######        ######\n");
 printf("##############################################################\n");
 printf("#...#......#.##...#......#.##...#......#.##------------------#\n");
 printf("###########################################------------------#\n");
 printf("#..#....#....##..#....#....##..#....#....#####################\n");
 printf("##########################################    #----------#\n");
 printf("#.....#......##.....#......##.....#......#    #----------#\n");
 printf("##########################################    #----------#\n");
 printf("#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#\n");
 printf("##########################################    ############\n");
 return 0; 
} 

解法8(PHP):

********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############

解法9(python最短代码挑战赛):

import zlib,base64;print zlib.decompress(base64.b64decode('eJylUkEOwCAIu/sKk95Mxv+fN2AsE0S3xR42sRYqUqtHM5TJfsaBQQyQZ3jTGLp+JcqIjBUMSUMYy1Z6EB1J0hCOrhuywnoeXo4gF5U1I0nxJhc3rKSmH2vDd/Ny+nkMa6I3F7xmallrgvRh0K9L4DzLPLZQ9IY2CdekTKNjwK/qqdwK4J7TeZSa/wxtWKjc3W4VjdKdqt2tsIp2q3Y4AbV3oO4=')).decode()

解法10(ascll版):

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<climits>
#include<cfloat>
#include<queue>
#include<cstddef>

using namespace std;
char x;
int a[10000]={32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,42,42,42,42,42,42,42,42,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,42,42,42,42,42,42,42,42,42,42,42,42,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,35,46,46,46,46,35,46,10,32,32,32,32,32,32,32,32,32,32,32,32,32,35,46,46,35,35,35,46,46,46,46,46,35,35,46,46,46,46,10,32,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,46,46,46,46,46,46,46,35,35,35,35,35,35,32,32,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,46,46,46,46,46,46,46,46,46,46,46,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,35,46,46,46,35,32,32,32,32,32,32,32,32,32,32,35,46,46,46,35,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,35,35,42,35,35,35,35,35,35,35,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,35,46,35,46,35,32,32,32,32,32,32,32,32,32,32,35,46,35,46,35,10,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,35,42,42,42,42,42,42,42,35,35,35,35,35,35,32,32,32,32,32,32,32,32,32,32,32,32,32,35,46,35,46,35,32,32,32,32,32,32,32,32,32,32,35,46,35,46,35,10,32,32,32,32,32,32,32,32,32,32,32,46,46,46,35,42,42,42,46,42,42,42,42,46,42,35,35,35,46,46,46,46,32,32,32,32,32,32,32,32,32,32,35,46,46,46,35,32,32,32,32,32,32,32,32,32,32,35,46,46,46,35,10,32,32,32,32,32,32,32,32,32,32,32,46,46,46,46,42,42,42,42,42,42,42,42,42,42,35,35,46,46,46,46,46,32,32,32,32,32,32,32,32,32,32,32,35,35,35,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,10,32,32,32,32,32,32,32,32,32,32,32,46,46,46,46,42,42,42,42,32,32,32,32,42,42,42,42,42,46,46,46,46,10,32,32,32,32,32,32,32,32,32,32,32,32,32,35,35,35,35,32,32,32,32,32,32,32,32,35,35,35,35,10,32,32,32,32,32,32,32,32,32,32,32,35,35,35,35,35,35,32,32,32,32,32,32,32,32,35,35,35,35,35,35,10,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,10,35,46,46,46,35,46,46,46,46,46,46,35,46,35,35,46,46,46,35,46,46,46,46,46,46,35,46,35,35,46,46,46,35,46,46,46,46,46,46,35,46,35,35,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,35,10,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,35,10,35,46,46,35,46,46,46,46,35,46,46,46,46,35,35,46,46,35,46,46,46,46,35,46,46,46,46,35,35,46,46,35,46,46,46,46,35,46,46,46,46,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,10,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,32,32,32,32,35,45,45,45,45,45,45,45,45,45,45,35,10,35,46,46,46,46,46,35,46,46,46,46,46,46,35,35,46,46,46,46,46,35,46,46,46,46,46,46,35,35,46,46,46,46,46,35,46,46,46,46,46,46,35,32,32,32,32,35,45,45,45,45,45,45,45,45,45,45,35,10,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,32,32,32,32,35,45,45,45,45,45,45,45,45,45,45,35,10,35,46,35,46,46,35,46,46,46,46,35,46,46,35,35,46,35,46,46,35,46,46,46,46,35,46,46,35,35,46,35,46,46,35,46,46,46,46,35,46,46,35,32,32,32,32,35,45,45,45,45,45,45,45,45,45,45,35,10,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,32,32,32,32,35,35,35,35,35,35,35,35,35,35,35,35,10};
int main()
{
//  被我注释掉的部分是我当时拿来转换的程序
//  freopen("x.in","r",stdin);
//  freopen("x.out","w",stdout);
//  x=getchar();
//  while(x!=EOF)
//  {
//      printf("%d,",(int)x);
//      x=getchar();
//  }
    for(int i = 0;i <= 1148;i++)
    {
        cout<<(char)a[i]; 
    } 
    return 0;
}

解法11(pascal手打压缩):

const
  p:ansistring=' 9 3*6! 9 2*9*! 9 2#2.2#.! 9 0#.0#1.3#0.2! 9 0#1.5#4 9 1#1 9 #1! 9 3.9 9 2#.1# 8#.1#! 9 2#0*#5 9 4#.#.# 8#.#.#! 9 #2*5#4 9 0#.#.# 8#.#.#! 9.1#*1.*2.*#1.2 8#.1# 8#.1#! 9.2*8#0.3 9#1 9 #1! 9.2*2 2*3.2! 9 0#2 6#2! 9#4 6#4!#9#9#9#9#9#5!#.1#.4#.#0.1#.4#.#0.1#.4#.#0-9-5#!#9#9#9#8-9-5#!#.0#.2#.2#0.0#.2#.2#0.0#.2#.2#9#8!#9#9#9#7 2#-8#!#.3#.4#0.3#.4#0.3#.4# 2#-8#!#9#9#9#7 2#-8#!#.#.0#.2#.0#0.#.0#.2#.0#0.#.0#.2#.0# 2#-8#!#9#9#9#7 2#9#!';
var i,j:longint;
begin
  for i:=1 to length(p) do
    case p[i] of
      '0'..'9':for j:=1 to ord(p[i])-ord('0')+1 do write(p[i-1]);
      '!':writeln;
    else write(p[i])
  end
end.

解法12(Ruby):

puts <<EOF
                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############
EOF

好了,就这么多。

相关阅读

玩什么游戏能赚钱?边玩边赚钱,妈妈再也不用担心我玩游戏

玩儿游戏一直是一件非常负能量的事情。玩物丧志,沉迷网络,网瘾少年,各种负能量标签纷至沓来。可是你有没有想过呢?就是这些非常负能量

金钻国际出品,超级玩家区块链游戏平台火热上线

超级玩家游戏平台正式发布,玩赚区块链!近日,金钻国际进军中国市场,不惜重金聘请硅谷技术团队为中国市场量身打造了基于区款链的游戏

网络游戏私服行业现状和反私服的措施

本文是今天在公司内部做的分享 私服行业现状 私服是怎么来的? 简单点说就是服务端泄漏了。 至于泄漏的原因,那就太多了,有

专访盛大游戏千年3:仗剑十载枪不倒 老牌端游的“侠”与

如果盘点中国市场上能称得上经典的武侠端游,那一定少不了《千年》。作为最早进入中国市场的经典韩游之一,《千年》凭借新颖和超前的

游艺道推出游戏生成器,想让普通人也可以做游戏创业

8月20日,游艺道游戏资源与服务交易平台更新了制作游戏功能。设立这个功能是为了帮助更多人实现自己制作游戏的梦想&mdash;&mdash;

分享到:

栏目导航

推荐阅读

热门阅读