当前位置:网站首页>PAT甲级 1031 Hello World for U
PAT甲级 1031 Hello World for U
2022-07-03 07:34:00 【九是否非随机的称呼】
注意计算出n1、n2、n3遍历,以及输出的次序即可
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char **argv){
string s, s0;
int i, j, k;
cin>>s;
int n1, n2, n3, maxmax = -999, l, mar;
l = s.length();
for(i = 3; i <= l; i++){
mar = 999;
for(j = i; j >= 0; j--){
if((j * 2 + i -2)== l){
mar = -999;
break;
}
}
if(mar < 0 && maxmax < j){
maxmax = j;
n2 = i;
}
}
n1 = n3 = maxmax;
for(i = 0; i < n1; i++){
cout<<s[i];
if(i != (n1 - 1))
for(j = 0; j < (n2 - 2); j++) cout<<" ";
else
for(j = 0; j < (n2 - 2); j++) cout<<s[i + j + 1];
cout<<s[l - i - 1]<<endl;
}
return EXIT_SUCCESS;
}
边栏推荐
- 技术干货|昇思MindSpore初级课程上线:从基本概念到实操,1小时上手!
- OSI knowledge sorting
- Leetcode 198: house raiding
- 【MySQL 12】MySQL 8.0.18 重新初始化
- Collector in ES (percentile / base)
- VMware network mode - bridge, host only, NAT network
- 2021-07-18
- 项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现
- The embodiment of generics in inheritance and wildcards
- PgSQL converts string to double type (to_number())
猜你喜欢
The embodiment of generics in inheritance and wildcards
Map interface and method
技术干货|AI框架动静态图统一的思考
Dora (discover offer request recognition) process of obtaining IP address
Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
Analysis of the problems of the 10th Blue Bridge Cup single chip microcomputer provincial competition
论文学习——鄱阳湖星子站水位时间序列相似度研究
图像识别与检测--笔记
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
随机推荐
JUnit unit test of vertx
技术干货|昇思MindSpore可变序列长度的动态Transformer已发布!
VMware virtual machine installation
Technical dry goods | reproduce iccv2021 best paper swing transformer with Shengsi mindspire
Hnsw introduction and some reference articles in lucene9
The babbage industrial policy forum
Common architectures of IO streams
C code production YUV420 planar format file
[Development Notes] cloud app control on device based on smart cloud 4G adapter gc211
Custom generic structure
Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
Map interface and method
Sent by mqtt client server of vertx
JS monitors empty objects and empty references
Application of pigeon nest principle in Lucene minshouldmatchsumscorer
Hello world of vertx
PgSQL converts string to double type (to_number())
Download address collection of various versions of devaexpress
项目经验分享:基于昇思MindSpore,使用DFCNN和CTC损失函数的声学模型实现
Leetcode 213: looting II