当前位置:网站首页>Good at C (day 70)
Good at C (day 70)
2022-07-21 09:55:00 【Zhangxueheng】
List of articles
1: subject
When you are asked by the interviewer to use C Write a Hello World when , Do you have the ability to write one out as shown in the figure below ?
Input format
The input first gives 26 English capital letters A−Z, One for each letter 7×5 Of 、 from C and . The matrix formed by .
Finally, give a sentence in one line , End with a carriage return . A sentence consists of several words ( Each contains no more than 10 Consecutive capital letters ) Composed of , Words are separated by any non capitalized English letter .
The title is guaranteed to give at least one word .
Output format
For each word , Output each letter in a row in matrix form , There is a column of spaces between the letters . There must be no extra spaces at the beginning and end of the word .
There must be a space between two adjacent words . There must be no extra blank lines at the beginning and end of the output .
Data range
The total length range of the last line of sentences [1,5000],
Given word number range [1,300].
sample input :
..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!
sample output :
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.
2: Code implementation
#include <iostream>
#include <cstring>
#include <algorithm>
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;
}
边栏推荐
- QT tablewidget determines whether a row is selected and obtains the data of the selected row
- 每日一题·1260.二维网络迁移·模拟
- 哪些自动化工具赋能电商运营效率翻倍?
- 7.24聚会通知
- js && ||
- 微信小程序中使用vant weapp
- 【无标题】
- c语言力扣第七题之翻转数字。暴力法
- [HMS core] [push kit] [FAQ] Huawei push service mobile phone does not receive push message / message delay / information screen notification problem collection
- 迅为龙芯开发板固态硬盘启动(烧写系统到固态)-分区
猜你喜欢
财务RPA机器人赋能企业,开启智能新时代
【mindspore】【训练警告】执行训练代码时存在的警告
Azure安全基础知识
Nacos custom extended data ID configuration
【论文笔记】基于深度强化学习的机器人操作行为研究综述
可以将网址在线打包封装成APK系统的完全开源源码
关于win7/win10系统安装的基本设置
【HarmonyOS】【ArkUI】鸿蒙 linear-gradient 来实现渐变色,怎么动态设置呢?尝试了一下,供大家参考
字体随窗体的变化而变化
U-Net: Convolutional Networks for Biomedical Image Segmentation
随机推荐
2022新版的第三方宝塔面板 btcloud PHP源码
Skipped 60 frames! The application may be doing too much work on its main thread
Write multiple main in the source file of vs stdio project
DOS汇编分支、循环编程与寄存器分析
网易游戏 Flink SQL 平台化实践
数字信号处理综合MATLAB设计 双音多频拨号系统
js && ||
【Mindspore-ascend】【运行错误】graph_mode模式下,运行网络报错
thinkphp5中使用phpmailer实现发送邮件功能
With the flow dividend receding, how can FMCG agents break through and grow with RPA?
微信小程序开发学习5(自定义组件)
【转】Jackson之多态反序列化(父类转不同子类)
GUI 基础应用
[target detection] yolov1-v3 principle
恩智浦i.MX6Q开发板软硬件全开源提供核心板原理图
flv.js的追帧、断流重连及实时更新的直播优化方案
iperf详细使用方法
【BERT】模型返回值解析
JS validation can only enter numbers and a decimal point
U-Net: Convolutional Networks for Biomedical Image Segmentation