<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 馬爾可夫矩陣程序 > 原文: [https://www.geeksforgeeks.org/markov-matrix/](https://www.geeksforgeeks.org/markov-matrix/) 給定一個 m x n 2D 矩陣,請檢查它是否為馬爾可夫矩陣。 **馬爾可夫矩陣**:每行總和等于 1 的矩陣。 ![](https://img.kancloud.cn/fc/bc/fcbc2d27d5049fe87e15b4f46c23580a_500x400.png) 馬爾可夫矩陣的例子 **示例**: ``` Input : 1 0 0 0.5 0 0.5 0 0 1 Output : yes Explanation : Sum of each row results to 1, therefore it is a Markov Matrix. Input : 1 0 0 0 0 2 1 0 0 Output : no ``` **方法**:初始化一個 2D 數組,然后使用另一個一維數組存儲矩陣的每一行的總和,并檢查存儲在此 1D 數組中的所有總和是否等于 1,如果是,則它 是馬爾可夫矩陣,否則不是。 ## C++ ```cpp // C++ code to check Markov Matrix #include <iostream> using namespace std; #define n 3 bool checkMarkov(double m[][n]) { ????// outer loop to access rows ????// and inner to access columns ????for (int i = 0; i <n; i++) { ????????// Find sum of current row ????????double sum = 0; ????????for (int j = 0; j < n; j++) ????????????sum = sum + m[i][j]; ????????if (sum != 1) ????????return false; ????} ????return true; } // Driver Code int main()? { ????// Matrix to check ????double m[3][3] = { { 0, 0, 1 }, ????????????????????{ 0.5, 0, 0.5 }, ????????????????????{ 1, 0, 0 } }; ????// calls the function check() ????if (checkMarkov(m)) ????????cout << " yes "; ????else ????????cout << " no "; } // This code is contributed by Anant Agarwal. ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看