20153:补足程序3(next_permutation)

来源:互联网 发布:淘宝怎么出售禁售商品 编辑:程序博客网 时间:2024/05/22 00:29

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
样例输入
样例输出
213231312321
提示

只填写一个函数名。

注: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 (
// 在此处补充你的代码 next_permutation
(s.begin(),s.end())) {cout << s << endl; }return 0;}

#include <iostream>#include <algorithm>#include <string> using namespace std;int main(){string s = "132";while (
// 在此处补充你的代码
(s.begin(),s.end())) {cout << s << endl; }return 0;}
0 0
原创粉丝点击