codeup1967 数组逆置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了codeup1967 数组逆置相关的知识,希望对你有一定的参考价值。

//基本都是多组数据测试,所以不要写一组数据的代码格式!!!
//全排列next_permutation()函数还真得用do{}while()循环格式来写;
#include<iostream> #include<algorithm> #include<string> using namespace std; int main() { string str; while (getline(cin, str))//cin读字符串遇到空格就截止,用getline是考虑到字符串可能有空格 { reverse(str.begin(), str.end());//翻转函数是左闭右开,可见end是结尾的下一个位置 cout << str << endl; } return 0; }

 

以上是关于codeup1967 数组逆置的主要内容,如果未能解决你的问题,请参考以下文章

表逆置[数组和链表]

哈工大机考:数组逆置

单链表逆置

用异或操作实现的交换函数用以实现数组逆置中须要注意的问题

数组逆置

求数组逆置(数组与指针实现)