1031. Hello World for U (20)
2015-06-20 09:39
351 查看
#define _CRT_SECURE_NO_WARNINGS
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
string s;
cin >> s;
int x1 = (s.size() + 2) / 3;
int x3 = x1;
int x2 = x1 + (s.size() + 2) % 3;
for (int i = 0; i < x1 - 1; i++)
{
cout << s[i];
for (int j = 0; j < x2 - 2; j++)
cout << " ";
cout << s[s.size()-i-1]<<endl;
}
for (int i = 0; i < x2; i++)
cout << s[x1 - 1 + i];
cout << endl;
return 0;
}
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main()
{
string s;
cin >> s;
int x1 = (s.size() + 2) / 3;
int x3 = x1;
int x2 = x1 + (s.size() + 2) % 3;
for (int i = 0; i < x1 - 1; i++)
{
cout << s[i];
for (int j = 0; j < x2 - 2; j++)
cout << " ";
cout << s[s.size()-i-1]<<endl;
}
for (int i = 0; i < x2; i++)
cout << s[x1 - 1 + i];
cout << endl;
return 0;
}
相关文章推荐
- iOS开发中的UIWebView的一些技巧1
- 单碟硬盘和多碟硬盘
- Objective-C----NSDictionary、NSMutableDictionary
- Lovo 6月19号课程总结
- Swift 基础
- Python标准库:内置函数__import__(name, globals=None, locals=None, fromlist=(), level=0)
- Spring配置iBatis多个SqlMapConfig.xml
- Python标准库:内置函数__import__(name, globals=None, locals=None, fromlist=(), level=0)
- WindowBuilder离线安装
- Intersection of Two Linked Lists -- leetcode
- SQL Server 附加数据库 错误5210
- 补第二次冲刺站立会议2(原6月4日)
- ASP.NET MVC5利用EF,反向自动生成数据库
- 多线程模拟实现生产者/消费者模型
- validate jquery 注册页面使用实例 详解
- 通过遍历生日找回PSN密码
- openCV-cvMat数据结构
- Android源码大放送之material design类型
- Objective-C----NSArray、NSMutableArray
- 分布式网站架构后续:zookeeper技术浅析