HDU 1062(水题)
来源:互联网 发布:大数据安全与隐私保护 编辑:程序博客网 时间:2024/06/03 09:27
题意:如题。
#include <cstdio>#include <string>#include <iostream>#include <algorithm>using namespace std;void deal(string& line, int start, int end){ end -= 1; while (start < end) { line[start] ^= line[end] ^= line[start] ^= line[end]; start++, end--; }}void result(string& line){ int start, end = 0; bool flag = false; while (1) { start = line.find_first_not_of(' ', end); if (start == string::npos) return; end = line.find_first_of(' ', start); if (end == string::npos) { flag = true; end = line.length(); } deal(line, start, end); if (flag) return; }}int main(){ int n; cin >> n; getchar(); string line; while (n--) { getline(cin, line); result(line); cout << line << endl; } return 0;}
0 0
- HDU 1062(水题)
- HDU 1062 字符串翻转 (水题)
- HDU 1800(水题!!! @@)
- HDU 1001(水题)
- HDU 1021(水题)
- HDU 1032(水题)
- HDU 1056(水题)
- HDU 1064(水题)
- HDU 1070(水题)
- HDU 1095(水题)
- HDU 1096(水题)
- HDU 1234(水题)
- hdu 2044 (水题)
- HDU--Elevator(水题)
- HDU-2055(水题)
- HDU-1425(水题)
- HDU 1062 Text Reverse(水题)
- hdu 1062(Text Reverse)
- javascript 数组详解 Array
- iOS7下status bar相关问题的解决方法
- VxWorks增加组件
- Leetcode: Anagrams
- [cocos2d-x]对CCSprite进行高斯模糊
- HDU 1062(水题)
- 在Ubuntu上使用vsftpd搭建FTP服务器
- secureCRT给我加了个0D
- ZOJ-2240
- VS2005 添加右键快捷菜单
- HDU 1064(水题)
- easymock单元测试实例二
- c# 读xml文件
- WinCE驱动编写小结