20153:补足程序3
-
总时间限制:
- 1000ms 内存限制:
- 65536kB
-
描述
-
补足下面的程序,使之输出结果是:
213
231
312
321
-
#include <iostream> #include <algorithm> #include <string> using namespace std; int main() { string s = "132"; while (
// 在此处补充你的代码
-
(s.begin(),s.end()) ) { cout << s << endl; } return 0; }
输入
- 无 输出
-
213
231
312
321
样例输入
-
无
样例输出
-
213 231 312 321
提示
-
#include <iostream> #include <algorithm> #include <string> using namespace std; int main() { string s = "132"; while (
// 在此处补充你的代码 next_permutation
-
(s.begin(),s.end()) ) { cout << s << endl; } return 0; }
只填写一个函数名。
注:next_permutation(first,last)
原型:
template <class InIt>
next_permutation(InIt first,InIt last);
求区间内的下一个序列;
所以只需填入此函数名即可;
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
string s = "132";
while (
// 在此处补充你的代码
(s.begin(),s.end())
) {
cout << s << endl;
}
return 0;
}