| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1681 人关注过本帖
标题:求大佬指点一下,运行不了
取消只看楼主 加入收藏
黑鸭
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2020-6-22
结帖率:20%
收藏
已结贴  问题点数:10 回复次数:1 
求大佬指点一下,运行不了
#include <iostream>
#include <functional>
#include <algorithm>
using namespace std;

int main(void)
{
    char buf[] = { 'A','A','4','4','3','3','2','2' };
    for (; std::next_permutation(begin(buf), end(buf), std::greater<char>()); )
    {
        auto a1 = std::find(begin(buf), end(buf), 'A');
        auto a2 = std::find(a1 + 1, end(buf), 'A');
        if (a1 + 2 != a2) continue;

        auto b1 = std::find(begin(buf), end(buf), '2');
        auto b2 = std::find(b1 + 1, end(buf), '2');
        if (b1 + 3 != b2) continue;

        auto c1 = std::find(begin(buf), end(buf), '3');
        auto c2 = std::find(c1 + 1, end(buf), '3');
        if (c1 + 4 != c2) continue;

        auto d1 = std::find(begin(buf), end(buf), '4');
        auto d2 = std::find(d1 + 1, end(buf), '4');
        if (d1 + 5 != d2) continue;

        break;
    }

    cout.write(buf, size(buf));
}
搜索更多相关主题的帖子: end find auto std begin 
2020-06-22 17:22
黑鸭
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2020-6-22
收藏
得分:0 
回复 3楼 牧人马
翻了一下书找到解决的方法了
2020-06-23 10:10
快速回复:求大佬指点一下,运行不了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026763 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved