题解:P1000 超级玛丽游戏

· · 题解

介绍一种使用 C++11 特性输出多行字符串的方法:原始字符串字面量。

cppref 文档

原始字符串字面量以 R"( 开头,以 )" 结尾,中间可以添加换行。代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
    cout << R"(                ********
               ************
               ####....#.
             #..###.....##....
             ###.......######              ###            ###
                ...........               #...#          #...#
               ##*#######                 #.#.#          #.#.#
            ####*******######             #.#.#          #.#.#
           ...#***.****.*###....          #...#          #...#
           ....**********##.....           ###            ###
           ....****    *****....
             ####        ####
           ######        ######
##############################################################
#...#......#.##...#......#.##...#......#.##------------------#
###########################################------------------#
#..#....#....##..#....#....##..#....#....#####################
##########################################    #----------#
#.....#......##.....#......##.....#......#    #----------#
##########################################    #----------#
#.#..#....#..##.#..#....#..##.#..#....#..#    #----------#
##########################################    ############)";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    // ll t; cin >> t; while (t--)
    solve();
    return 0;
}