当前位置:网站首页>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;
}边栏推荐
- 圖像識別與檢測--筆記
- 技术干货 | AlphaFold/ RoseTTAFold开源复现(2)—AlphaFold流程分析和训练构建
- Unified handling and interception of exception exceptions of vertx
- Vertx's responsive redis client
- Map interface and method
- An overview of IfM Engage
- 技术干货|关于AI Architecture未来的一些思考
- [cmake] cmake link SQLite Library
- Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
- Chrome 98 Private Network Access problem w/ disabled web security: Request had no target IP address
猜你喜欢
随机推荐
SQL create temporary table
Traversal in Lucene
2021-07-18
TCP cumulative acknowledgement and window value update
Technical dry goods Shengsi mindspire lite1.5 feature release, bringing a new end-to-end AI experience
你开发数据API最快多长时间?我1分钟就足够了
The difference between typescript let and VaR
Spa single page application
pgAdmin 4 v6.11 发布,PostgreSQL 开源图形化管理工具
PdfWriter. GetInstance throws system Nullreferenceexception [en] pdfwriter GetInstance throws System. NullRef
PgSQL converts string to double type (to_number())
【MySQL 14】使用DBeaver工具远程备份及恢复MySQL数据库(Linux 环境)
Pgadmin 4 v6.11 release, PostgreSQL open source graphical management tool
Project experience sharing: realize an IR Fusion optimization pass of Shengsi mindspire layer
圖像識別與檢測--筆記
How long is the fastest time you can develop data API? One minute is enough for me
项目经验分享:实现一个昇思MindSpore 图层 IR 融合优化 pass
Lucene merge document order
List exercises after class
Leetcode 198: 打家劫舍
https://github.com/ZouJiu1/PAT








