<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 基礎練習 01字串? 問題描述 對于長度為5位的一個01串,每一位都可能是0或1,一共有32種可能。它們的前幾個是: 00000 00001 00010 00011 00100 請按從小到大的順序輸出這32種01串。 輸入格式 本試題沒有輸入。 輸出格式 輸出32行,按從小到大的順序每行一個長度為5的01串。 樣例輸出 00000 00001 00010 00011 <以下部分省略> 這道題目,我總結了四種方法供大家選擇+ +. ~~~ // 01 字串 // 方法一:暴力(這個可以有) #include <iostream> using namespace std; int main() { cout<<"00000"<<endl; cout<<"00001"<<endl; cout<<"00010"<<endl; cout<<"00011"<<endl; cout<<"00100"<<endl; cout<<"00101"<<endl; cout<<"00110"<<endl; cout<<"00111"<<endl; cout<<"01000"<<endl; cout<<"01001"<<endl; cout<<"01010"<<endl; cout<<"01011"<<endl; cout<<"01100"<<endl; cout<<"01101"<<endl; cout<<"01110"<<endl; cout<<"01111"<<endl; cout<<"10000"<<endl; cout<<"10001"<<endl; cout<<"10010"<<endl; cout<<"10011"<<endl; cout<<"10100"<<endl; cout<<"10101"<<endl; cout<<"10110"<<endl; cout<<"10111"<<endl; cout<<"11000"<<endl; cout<<"11001"<<endl; cout<<"11010"<<endl; cout<<"11011"<<endl; cout<<"11100"<<endl; cout<<"11101"<<endl; cout<<"11110"<<endl; cout<<"11111"<<endl; return 0; } // 方法二:五層循環法 #include <iostream> using namespace std; int main() { int a,b,c,d,e; for(a=0;a<2;++a) for(b=0;b<2;++b) for(c=0;c<2;++c) for(d=0;d<2;++d) for(e=0;e<2;++e) cout<<a<<b<<c<<d<<e<<endl; return 0; } // 方法三:模擬二進制運算 #include <iostream> #include <string> using namespace std; int main() { int i,j; string str="00000"; for(i=0;i<32;++i) { cout<<str<<endl; str[4]+=1; for(j=4;j>=0;--j) { if(str[j]=='2') { str[j-1]+=1; str[j]='0'; } } } return 0; } // 方法四:十進制轉換二進制法 #include <iostream> using namespace std; int main() { for(int i=0;i<32;i++){ cout<<i%32/16<<i%16/8<<i%8/4<<i%4/2<<i%2<<endl; } return 0; } ~~~
                  <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>

                              哎呀哎呀视频在线观看