日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

Codeforces Beta Round #5 B. Center Alignment 模拟题

發(fā)布時(shí)間:2023/12/19 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces Beta Round #5 B. Center Alignment 模拟题 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

B. Center Alignment

題目連接:

http://www.codeforces.com/contest/5/problem/B

Description

Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor ?Textpad? decided to introduce this functionality into the fourth release of the product.

You are to implement the alignment in the shortest possible time. Good luck!

Input

The input file consists of one or more lines, each of the lines contains Latin letters, digits and/or spaces. The lines cannot start or end with a space. It is guaranteed that at least one of the lines has positive length. The length of each line and the total amount of the lines do not exceed 1000.

Output

Format the given text, aligning it center. Frame the whole text with characters ?*? of the minimum size. If a line cannot be aligned perfectly (for example, the line has even length, while the width of the block is uneven), you should place such lines rounding down the distance to the left or to the right edge and bringing them closer left or right alternatively (you should start with bringing left). Study the sample tests carefully to understand the output format better.

Sample Input

This is

Codeforces
Beta
Round
5

Sample Output


  • This is *
  • * Codeforces
  • Beta *
  • Round *
  • 5 *

Hint

題意

給你一堆字符串,讓你居中

如果恰好居中的話,那就居中

如果不是的話,先偏左邊,然后再偏右邊去

題解:

模擬題,按照題意模擬就好了。

代碼

#include<bits/stdc++.h> using namespace std; const int maxn = 2005; string s[maxn],s1; int mx,tot; int main() {while(getline(cin,s1)){s[tot++]=s1;mx = max((int)s1.size(),mx);}for(int i=0;i<mx+2;i++)cout<<"*";cout<<endl;int d = 0;for(int i=0;i<tot;i++){cout<<"*";int len = (mx-s[i].size());if(len%2==1)d++;int l = len/2;int r = len/2;if(len%2==1&&d%2==1)r++;else if(len%2==1)l++;for(int j=0;j<l;j++)cout<<" ";cout<<s[i];for(int j=0;j<r;j++)cout<<" ";cout<<"*"<<endl;}for(int i=0;i<mx+2;i++)cout<<"*";cout<<endl; }

轉(zhuǎn)載于:https://www.cnblogs.com/qscqesze/p/5304189.html

總結(jié)

以上是生活随笔為你收集整理的Codeforces Beta Round #5 B. Center Alignment 模拟题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: av美女在线 | 污网站在线免费看 | 精品久久一区 | 婷婷爱五月天 | 国产日日操 | 亚洲区视频在线观看 | 无码国产69精品久久久久同性 | 一区二区三区视频在线播放 | 精品午夜视频 | 玖玖爱精品 | 日本一区二区三区四区五区 | 日本久色 | japanese24hdxxxx中文字幕 | 狠久久| 日韩欧美一区二区三区四区五区 | 91看片国产| 99精品欧美一区二区 | 成人天堂网 | 色视频一区二区 | 色婷婷基地 | 风流老熟女一区二区三区 | 美女高潮在线 | 欧美黄色网络 | 国产精品免费看 | 亚洲第一精品在线观看 | 色天使亚洲| 亚洲高清精品视频 | 免费看的av片 | 无码aⅴ精品一区二区三区 精品久久在线 | 午夜毛片在线观看 | 国产免费又爽又色又粗视频 | 相亲对象是问题学生在线观看 | 中文字幕一区在线播放 | 日韩在线观看中文字幕 | 99精品视频免费看 | 波多野结衣电影在线播放 | 日韩视频免费观看高清 | 国产男女裸体做爰爽爽 | 国产日产欧洲无码视频 | 日本乱论视频 | japanesexxxx日本妞 | 91新网站| 国产又黄又湿 | 欧美 日韩 国产 一区 | 欧美成人777| 久久福利片 | 免费a v网站 | 国产一区二区三区影视 | 欧美另类极品videosbest使用方法 | 午夜精品久久久内射近拍高清 | 久久av网站| 国产亚洲一区二区三区 | 久久久久久亚洲精品中文字幕 | 国产自产精品 | 四虎永久免费在线观看 | 四虎5151久久欧美毛片 | 亚洲综合精品国产 | 精品人人妻人人澡人人爽牛牛 | 人妻少妇被粗大爽9797pw | 法国空姐电影在线 | 天天干天天操天天舔 | 天天射天天拍 | 精品国产aⅴ麻豆 | 黑人性视频 | 亚洲熟妇无码乱子av电影 | 久久精品欧美一区 | 超碰综合 | 钰慧的mv视频在线观看 | av男人的天堂在线观看 | 亚洲AV无码精品久久一区二区 | 成人网在线播放 | 72pao成人国产永久免费视频 | 中文字幕无码乱人伦 | 久久一区欧美 | 国产av无码专区亚洲av | 视频在线观看91 | 女人18毛片毛片毛片毛片区二 | 免费视频91蜜桃 | 亚色在线 | 国产有码在线 | 五月天视频 | 97中文在线| 美女网站免费视频 | 欧美黄页| 夜夜成人 | 亚洲精品国产精品国自产在线 | 天天尻逼| 在线观看黄网站 | 少妇高潮喷水在线观看 | 国产精品一级 | 久久综合色视频 | 日批视频免费 | 午夜视频1000 | 国产精品久久在线观看 | 看国产一级片 | 爱情岛论坛永久入址测速 | 成人1区2区| 隣の若妻さん波多野结衣 | 久久国产精彩视频 |