uva 1593 Alignment of Code
来源:互联网 发布:淘宝饰品店铺名 编辑:程序博客网 时间:2024/06/05 04:14
题目:Alignment of Code
题意:给定一些代码片段,按给定的个时对其输出。
代码:
#include<cstdio>#include<iostream>#include<string>#include<vector>#include<set>#include<map>#include<algorithm>using namespace std;string before[1005];string a[1005][85];int cnt[1005]= {0};int Max=0;void change(int x) {before[x]+=" ";for(int i=0; i<before[x].size(); i++) {if(before[x][i]!=' ') {a[x][cnt[x]]+=before[x][i];} else if(i!=0&&before[x][i-1]!=' ') {cnt[x]++;}}Max=max(Max,cnt[x]);}int main() {int T=0;while(getline(cin,before[T++]));for(int i=0; i<T; i++) {change(i);}T--;int longest[85]= {0};for(int i=0; i<T; i++) {for(int j=0; j<Max; j++) {int x=a[i][j].size();longest[j]=max(longest[j],x);}}for(int i=0; i<T; i++) {for(int j=0; j<cnt[i]; j++) {cout<<a[i][j];if(j!=cnt[i]-1) {for(int k=a[i][j].size(); k<=longest[j]; k++) {cout<<' ';}}}cout<<endl;}return 0;}
阅读全文
2 0
- UVa 1593 Alignment of Code
- UVa 1593 - Alignment of Code
- UVa 1593 - Alignment of Code
- UVa 1593 Alignment of Code
- Uva - 1593 - Alignment of Code
- UVA 1593 Alignment of Code
- UVa 1593 - Alignment of Code
- UVA 1593 Alignment of Code
- UVa 1593 Alignment of Code
- uva 1593 Alignment of Code
- UVA 1593 Alignment of Code
- Uva Alignment of Code
- Alignment of Code UVA
- Alignment of Code UVA
- UVa 1593 Alignment of Code(字符串)
- UVa--1593 Alignment of Code(string)
- UVA 1593(p135)----Alignment of Code
- UVa 1593 Alignment of code 解题报告
- bind开启服务的生命周期
- 微信小程序与django
- 剑指offer Solution29
- jquery插件select2的所有事件,包括清除,删除,打开等
- 【Spring】后端解决跨域问题
- uva 1593 Alignment of Code
- Android硬件访问服务-HAL
- 神经网络NN算法
- php怎么写分页?怎么灵活实现分页的方法,快速在thinkphp里面实现分页
- AndroidStudio 视图自定义属性
- 【easyUI】combobox显示对象内容
- 深入理解事件
- Toast多次弹出的解决办法,随时取消已经弹出的Toast
- elasticsearch 常用接口