<legend id='NSYPV'><style id='NSYPV'><dir id='NSYPV'><q id='NSYPV'></q></dir></style></legend>
        <bdo id='NSYPV'></bdo><ul id='NSYPV'></ul>

      <small id='NSYPV'></small><noframes id='NSYPV'>

    1. <tfoot id='NSYPV'></tfoot>
    2. <i id='NSYPV'><tr id='NSYPV'><dt id='NSYPV'><q id='NSYPV'><span id='NSYPV'><b id='NSYPV'><form id='NSYPV'><ins id='NSYPV'></ins><ul id='NSYPV'></ul><sub id='NSYPV'></sub></form><legend id='NSYPV'></legend><bdo id='NSYPV'><pre id='NSYPV'><center id='NSYPV'></center></pre></bdo></b><th id='NSYPV'></th></span></q></dt></tr></i><div id='NSYPV'><tfoot id='NSYPV'></tfoot><dl id='NSYPV'><fieldset id='NSYPV'></fieldset></dl></div>

        几个向量的笛卡尔积

        时间:2023-09-15
        <tfoot id='BYunC'></tfoot>
          <tbody id='BYunC'></tbody>
          <legend id='BYunC'><style id='BYunC'><dir id='BYunC'><q id='BYunC'></q></dir></style></legend>

          <small id='BYunC'></small><noframes id='BYunC'>

          <i id='BYunC'><tr id='BYunC'><dt id='BYunC'><q id='BYunC'><span id='BYunC'><b id='BYunC'><form id='BYunC'><ins id='BYunC'></ins><ul id='BYunC'></ul><sub id='BYunC'></sub></form><legend id='BYunC'></legend><bdo id='BYunC'><pre id='BYunC'><center id='BYunC'></center></pre></bdo></b><th id='BYunC'></th></span></q></dt></tr></i><div id='BYunC'><tfoot id='BYunC'></tfoot><dl id='BYunC'><fieldset id='BYunC'></fieldset></dl></div>

              • <bdo id='BYunC'></bdo><ul id='BYunC'></ul>

                1. 本文介绍了几个向量的笛卡尔积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  之前有人问过类似的问题,但我找不到与我的问题完全匹配的问题.

                  similar questions have been asked before but I cant find an exact match to my question.

                  我有 4 个向量,每个向量包含 200-500 个 4 位整数.每个向量中元素的确切数量各不相同,但我可以将其固定为特定值.我需要找到这 4 个向量中元素的所有可能组合.

                  I have 4 vectors each of which hold between 200-500 4 digit integers. The exact number of elements in each vector varies but I could fix it to a specific value. I need to find all possible combinations of the elements in these 4 vectors.

                  例如:

                  v1[10, 30]v2[11, 45]v3[63, 56]v4[82, 98]

                  v1[10, 30] v2[11, 45] v3[63, 56] v4[82, 98]

                  所以我会得到这样的东西:

                  so I'd get something like this:

                  [10, 11, 63, 82];[30、11、63、82];[10、45、63、82];[10, 45, 56, 82] 等.

                  [10, 11, 63, 82]; [30, 11, 63, 82]; [10, 45, 63, 82]; [10, 45, 56, 82] etc..

                  这个算法是否有一个通用名称,以便我可以在网上找到一些参考资料?否则,在 C++ 中实现这一点的任何提示都会有所帮助.性能不是什么大问题,因为我只需要运行一次算法.STL 中是否有任何内置内容?

                  Is there a common name for this algorithm so I can find some references to it online? Otherwise any tips on implementing this in C++ would be helpful. Performance isn't much of an issue as I only need to run the algorithm once. Is there anything built into the STL?

                  推荐答案

                  算法不多...

                  for(vector<int>::const_iterator i1 = v1.begin(); i1 != v1.end(); ++i1)
                      for(vector<int>::const_iterator i2 = v2.begin(); i2 != v2.end(); ++i2)
                          for(vector<int>::const_iterator i3 = v3.begin(); i3 != v3.end(); ++i3)
                              for(vector<int>::const_iterator i4 = v4.begin(); i4 != v4.end(); ++i4)
                                  cout << "[" << *i1 << "," << *i2 << "," << *i3 << "," << *i4 << "]" << endl;
                  

                  这篇关于几个向量的笛卡尔积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:复制后的 std::vector 容量 下一篇:通过保留和复制,还是通过创建和交换来复制向

                  相关文章

                  最新文章

                  <small id='wyeGn'></small><noframes id='wyeGn'>

                  1. <legend id='wyeGn'><style id='wyeGn'><dir id='wyeGn'><q id='wyeGn'></q></dir></style></legend>

                      • <bdo id='wyeGn'></bdo><ul id='wyeGn'></ul>

                      <i id='wyeGn'><tr id='wyeGn'><dt id='wyeGn'><q id='wyeGn'><span id='wyeGn'><b id='wyeGn'><form id='wyeGn'><ins id='wyeGn'></ins><ul id='wyeGn'></ul><sub id='wyeGn'></sub></form><legend id='wyeGn'></legend><bdo id='wyeGn'><pre id='wyeGn'><center id='wyeGn'></center></pre></bdo></b><th id='wyeGn'></th></span></q></dt></tr></i><div id='wyeGn'><tfoot id='wyeGn'></tfoot><dl id='wyeGn'><fieldset id='wyeGn'></fieldset></dl></div>
                    1. <tfoot id='wyeGn'></tfoot>