跳到正文

题解

B4067 [GESP202412 三级] 打印数字 题解

Cy_candy约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年3月9日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
using namespace std;
string s0[5]={
	".....",
	".***.",
	".***.",
	".***.",
	"....."
}; 
string s1[5]={
	"****.",
	"****.",
	"****.",
	"****.",
	"****."
}; 
string s2[5]={
	".....",
	"****.",
	".....",
	".****",
	"....."
}; 
string s3[5]={
	".....",
	"****.",
	".....",
	"****.",
	"....."
};
string s, ans[5];

int main(){
	cin >> s;
	for(int i = 0; i < s.size(); i++)
	{
		for(int j = 0; j < 5; j++)
		{
			switch(s[i])
			{
				case '0':
					ans[j] += s0[j]; break;
				case '1':
					ans[j] += s1[j]; break;
				case '2':
					ans[j] += s2[j]; break;
				case '3':
					ans[j] += s3[j]; break;
			}
		}
	}
	for(int i = 0; i < 5; i++) cout << ans[i] << "\n";	
	return 0;
}
原文