<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                <table id="table1" class="grid grid_tb " border="0" cellpadding="0" cellspacing="0" style="margin:0px; padding:0px; list-style-type:none; border-spacing:0px; border-collapse:collapse; max-width:100%; background-color:rgb(219,222,223); font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif; width:968px; border:0px; empty-cells:show; color:rgb(51,51,51); font-size:14px; line-height:20px"><tbody style="margin:0px; padding:0px; list-style-type:none"><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td width="10%" class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">描述:?</td><td width="90%" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)"><p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; list-style-type:none"><span style="margin:0px; padding:0px; list-style-type:none">有這樣一道智力題:“某商店規定:三個空汽水瓶可以換一瓶汽水。小張手上有十個空汽水瓶,她最多可以換多少瓶汽水喝?”答案是5瓶,方法如下:先用9個空瓶子換3瓶汽水,喝掉3瓶滿的,喝完以后4個空瓶子,用3個再換一瓶,喝掉這瓶滿的,這時候剩2個空瓶子。然后你讓老板先借給你一瓶汽水,喝掉這瓶滿的,喝完以后用3個空瓶子換一瓶滿的還給老板。如果小張手上有n個空汽水瓶,最多可以換多少瓶汽水喝?</span><br style="margin:0px; padding:0px; list-style-type:none"/></p>?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">知識點:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">?循環?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">題目來源:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">?內部整理?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">練習階段:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">?中級?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">運行時間限制:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">無限制</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">內存限制:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">無限制</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">輸入:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">?<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; list-style-type:none"><span style="margin:0px; padding:0px; list-style-type:none">輸入文件最多包含10組測試數據,每個數據占一行,僅包含一個正整數n(1&lt;=n&lt;=100),表示小張手上的空汽水瓶數。n=0表示輸入結束,你的程序不應當處理這一行。</span><br style="margin:0px; padding:0px; list-style-type:none"/></p>?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">輸出:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">?<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; list-style-type:none"><span style="margin:0px; padding:0px; list-style-type:none">對于每組測試數據,輸出一行,表示最多可以喝的汽水瓶數。如果一瓶也喝不到,輸出0。</span><br style="margin:0px; padding:0px; list-style-type:none"/></p>?</td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">樣例輸入:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)"><pre style="margin-top:0px; margin-bottom:10px; padding:9.5px; list-style-type:none; white-space:pre-wrap; word-wrap:break-word; line-height:1.42857143; overflow:auto; font-family:Menlo,Monaco,Consolas,'Courier New',monospace; font-size:13px; word-break:break-all; background-color:rgb(245,245,245); border:1px solid rgb(204,204,204)">3 10 81 0 </pre></td></tr><tr style="margin:0px; padding:0px; list-style-type:none; height:26px"><td class="grid_left_td" style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; border-right-style:solid; border-right-width:1px; border-right-color:rgb(238,238,238); font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)">樣例輸出:</td><td style="margin:0px; padding:6px 3px 3px; list-style-type:none; word-break:break-all; word-wrap:break-word; font-family:'Microsoft YaHei',Arial,Helvetica,sans-serif!important; font-size:14px; border-bottom-style:solid; border-bottom-width:1px; border-bottom-color:rgb(238,238,238)"><pre style="margin-top:0px; margin-bottom:10px; padding:9.5px; list-style-type:none; white-space:pre-wrap; word-wrap:break-word; line-height:1.42857143; overflow:auto; font-family:Menlo,Monaco,Consolas,'Courier New',monospace; font-size:13px; word-break:break-all; background-color:rgb(245,245,245); border:1px solid rgb(204,204,204)">1 5 40 </pre></td></tr></tbody></table> 兩種方式處理,注意下面代碼中輸入不確定的n個數以0結束輸入的方法: ~~~ //方法一:找到規律就這么簡單n/2 void fun1() { int n; //注意這里輸入不確定個整數,以0結束的輸入方式 while (cin >> n, n) { if (n < 0) break; cout << n / 2 << endl; } } //方法二: int fun2(int n) { int remainder = 0; int divisor = 0; int count = 0; while (n / 3) { divisor = n / 3; remainder = n % 3; count += divisor; n = divisor + remainder; } //如果最后還剩兩個空瓶子,可以向老板借一個 //空瓶子再買一瓶 if (n % 3 == 2) count += 1; return count; } int main() { //fun1(); int n; while (cin >> n) { if (n != 0) { cout << fun2() << endl; } else break; } 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>

                              哎呀哎呀视频在线观看