当前位置:网站首页>4276. 擅长C
4276. 擅长C
2022-07-27 08:37:00 【追寻远方的人】
当你被面试官要求用 CC 写一个 Hello World 时,有本事像下图显示的那样写一个出来吗?

输入格式
输入首先给出 26 个英文大写字母 A−Z,每个字母用一个 7×5 的、由 C 和 . 组成的矩阵构成。
最后在一行中给出一个句子,以回车结束。句子是由若干个单词(每个包含不超过 10 个连续的大写英文字母)组成的,单词间以任何非大写英文字母分隔。
题目保证至少给出一个单词。
输出格式
对每个单词,将其每个字母用矩阵形式在一行中输出,字母间有一列空格分隔。单词的首尾不得有多余空格。
相邻的两个单词间必须有一空行分隔。输出的首尾不得有多余空行。
数据范围
最后一行句子的总长度范围 [1,5000][1,5000],
给出的单词数量范围 [1,300][1,300]。
输入样例:
..C..
.C.C.
C...C
CCCCC
C...C
C...C
C...C
CCCC.
C...C
C...C
CCCC.
C...C
C...C
CCCC.
.CCC.
C...C
C....
C....
C....
C...C
.CCC.
CCCC.
C...C
C...C
C...C
C...C
C...C
CCCC.
CCCCC
C....
C....
CCCC.
C....
C....
CCCCC
CCCCC
C....
C....
CCCC.
C....
C....
C....
CCCC.
C...C
C....
C.CCC
C...C
C...C
CCCC.
C...C
C...C
C...C
CCCCC
C...C
C...C
C...C
CCCCC
..C..
..C..
..C..
..C..
..C..
CCCCC
CCCCC
....C
....C
....C
....C
C...C
.CCC.
C...C
C..C.
C.C..
CC...
C.C..
C..C.
C...C
C....
C....
C....
C....
C....
C....
CCCCC
C...C
C...C
CC.CC
C.C.C
C...C
C...C
C...C
C...C
C...C
CC..C
C.C.C
C..CC
C...C
C...C
.CCC.
C...C
C...C
C...C
C...C
C...C
.CCC.
CCCC.
C...C
C...C
CCCC.
C....
C....
C....
.CCC.
C...C
C...C
C...C
C.C.C
C..CC
.CCC.
CCCC.
C...C
CCCC.
CC...
C.C..
C..C.
C...C
.CCC.
C...C
C....
.CCC.
....C
C...C
.CCC.
CCCCC
..C..
..C..
..C..
..C..
..C..
..C..
C...C
C...C
C...C
C...C
C...C
C...C
.CCC.
C...C
C...C
C...C
C...C
C...C
.C.C.
..C..
C...C
C...C
C...C
C.C.C
CC.CC
C...C
C...C
C...C
C...C
.C.C.
..C..
.C.C.
C...C
C...C
C...C
C...C
.C.C.
..C..
..C..
..C..
..C..
CCCCC
....C
...C.
..C..
.C...
C....
CCCCC
HELLO~WORLD!
输出样例:
C...C CCCCC C.... C.... .CCC.
C...C C.... C.... C.... C...C
C...C C.... C.... C.... C...C
CCCCC CCCC. C.... C.... C...C
C...C C.... C.... C.... C...C
C...C C.... C.... C.... C...C
C...C CCCCC CCCCC CCCCC .CCC.
C...C .CCC. CCCC. C.... CCCC.
C...C C...C C...C C.... C...C
C...C C...C CCCC. C.... C...C
C.C.C C...C CC... C.... C...C
CC.CC C...C C.C.. C.... C...C
C...C C...C C..C. C.... C...C
C...C .CCC. C...C CCCCC CCCC.
代码:
// 模拟
#include <bits/stdc++.h>
using namespace std;
char g[26][7][6];
bool is_first = true;
void output(string word)
{
if (word.empty())
return;
if (is_first)
is_first = false;
else
cout << endl;
char str[7][60] = {
0};
for (int i = 0; i < word.size(); i++)
{
for (int j = 0; j < 7; j++)
{
for (int k = 0; k < 5; k++)
str[j][i * 6 + k] = g[word[i] - 'A'][j][k];
}
}
for (int i = 1; i < word.size(); i++)
{
for (int j = 0; j < 7; j++)
str[j][i * 6 - 1] = ' ';
}
for (int i = 0; i < 7; i++)
cout << str[i] << endl;
}
int main()
{
for (int i = 0; i < 26; i++)
{
for (int j = 0; j < 7; j++)
cin >> g[i][j];
}
string word;
char c;
while ((c = getchar()) != -1)
{
if (c >= 'A' && c <= 'Z')
word += c;
else
{
output(word);
word = "";
}
}
output(word);
return 0;
}
边栏推荐
- JS basic knowledge - daily learning summary ①
- Redis configuration file download
- Use of "PHP Basics" Boolean
- Implementation of registration function
- Realization of backstage brand management function
- 1178 questions of Olympiad in informatics -- ranking of grades
- Massive data Xiao Feng: jointly build and govern opengauss root community and share a thriving new ecosystem
- UVM入门实验1
- Background image related applications - full, adaptive
- Background order management
猜你喜欢

Flask project configuration

How to view instances of software objects in QSIM?

借生态力量,openGauss突破性能瓶颈

Day5 - Flame restful request response and Sqlalchemy Foundation

"PHP Basics" use of integer data

Initial summary of flask framework creation project
![Connection failed during installation of ros2 [ip: 91.189.91.39 80]](/img/7f/92b7d44cddc03c58364d8d3f19198a.png)
Connection failed during installation of ros2 [ip: 91.189.91.39 80]
![[ciscn2019 southeast China division]web11 1](/img/94/61ad4f6cbbd46ff66f361462983d7a.png)
[ciscn2019 southeast China division]web11 1

The following license SolidWorks Standard cannot be obtained, and the use license file cannot be found. (-1,359,2)。

pytorch_demo1
随机推荐
Alibaba cloud international receipt message introduction and configuration process
帮忙发几个招聘,有兴趣可以看看
Process control - Branch
Supervisor 安装与使用
Cenos7 update MariaDB
如何卸载--奇安信安全终端管理系统
How to permanently set source
Use of flask
百人参与,openGauss开源社区这群人都在讨论什么?
Redis configuration file download
[geek challenge 2019] finalsql 1
Realize SPU management in the background
STM32 small bug summary
UVM Introduction Experiment 1
开怀一笑
Connection failed during installation of ros2 [ip: 91.189.91.39 80]
Use of "PHP Basics" delimiters
Apache SSI remote command execution vulnerability
面试官:什么是脚手架?为什么需要脚手架?常用的脚手架有哪些?
Forced login, seven cattle cloud upload pictures