当前位置:网站首页>pta L1-032 Left-pad(20分)
pta L1-032 Left-pad(20分)
2022-08-07 05:11:00 【Dream.Luffy】
直接输出即可,代码如下
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
int n;
char c;
string str;
cin >>n >> c;
getchar(); //读取回车
getline(cin ,str);
if(str.size() >= n)
for(int i = str.size() - n; i < str.size();i ++)
cout << str[i];
else
{
for(int i = n - str.size();i > 0;i --)
cout << c;
for(int i = 0;i < str.size();i ++)
cout << str[i];
}
return 0;
}边栏推荐
- Seq2Seq superficial understanding
- Brush the title "Sword Finger Offer" day11
- Detailed explanation of C51 basic functions, interrupt functions and library functions
- Go语言 | 05 Template学习
- [SemiDrive source code analysis] [MailBox inter-core communication] 48 - Modify the RPMSG IPCC RPC single transmission data size to 512 bytes (code actual combat part)
- SQL 改写系列七:谓词移动
- [Shader realizes the overall distortion effect of Distortion_Shader Effect Chapter 17]
- Linear algebra study notes 4-4: Solving the inhomogeneous system of linear equations Ax=b, looking at the equations from the perspective of rank
- 多线程之原子数组
- MySQL进阶1——底层数据结构B+树
猜你喜欢

Problems encountered with Flutter environment configuration

Brush the title "Sword Finger Offer" day11

IDEA 2022.2 发布,骚操作、跟不上

Find My Information | AirTag is helping more people find their lost luggage, and Find My is becoming more and more useful

Find My资讯|AirTag 正在帮更多人找到丢失的行李,Find My用处越来越大
![[Shader realizes the overall distortion effect of Distortion_Shader Effect Chapter 17]](/img/c3/6c4cdeed6e1b88e3163541d2ff0eae.png)
[Shader realizes the overall distortion effect of Distortion_Shader Effect Chapter 17]

小 P 周刊 Vol.14

Quantitative risk control rule development, how to better make policies and rules, catch bad guys

Redis关闭持久化

【Yu Niangniang】1373. Maximum key value and DFS of binary search subtree
随机推荐
MySQL
Golang Break, Continue out of multi-layer cycle
Redis 常用数据类型之list(字符串列表)
茶叶交易行情小程序开发制作功能介绍
正则表达式笔记
多线程之原子数组
Excel合并单元格测试代码
洛谷P1218 特殊的质数肋骨 Superprime Rib
洛谷P2412 查单词
《研究生科研能力训练与培养》
OK-MY TODO LIST
Excel单元格显示数据与实际数据不一致的设置与清除
字符脱敏工具
线性代数学习笔记5-1:正交的向量/空间、正交补(行空间和零空间正交)
happens-before规则与线程单例安全习题
npm install遇到Unexpected end of JSON input while parsing near ‘...onnect“:“^2.0.0“,“gru‘问题解决
Seq2Seq superficial understanding
Find My Information | AirTag is helping more people find their lost luggage, and Find My is becoming more and more useful
RT_thread的IIC设备学习笔记
SSM整合------全过程