#382 div.2

  • Tennis Championship
    Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn’t want to miss this event. There will be n players participating, and the tournament will follow knockout rules from the very first game. That means, that if someone loses a game he leaves the tournament immediately.

Organizers are still arranging tournament grid (i.e. the order games will happen and who is going to play with whom) but they have already fixed one rule: two players can play against each other only if the number of games one of them has already played differs by no more than one from the number of games the other one has already played. Of course, both players had to win all their games in order to continue participating in the tournament.

Tournament hasn’t started yet so the audience is a bit bored. Ostap decided to find out what is the maximum number of games the winner of the tournament can take part in (assuming the rule above is used). However, it is unlikely he can deal with this problem without your help.

Input
The only line of the input contains a single integer n (2 ≤ n ≤ 1018) — the number of players to participate in the tournament.

Output
Print the maximum number of games in which the winner of the tournament can take part.

Example
Input
2
Output
1
Input
3
Output
2
Input
4
Output
2
Input
10
Output
4
Note
In all samples we consider that player number 1 is the winner.

In the first sample, there would be only one game so the answer is 1.

In the second sample, player 1 can consequently beat players 2 and 3.

In the third sample, player 1 can’t play with each other player as after he plays with players 2 and 3 he can’t play against player 4, as he has 0 games played, while player 1 already played 2. Thus, the answer is 2 and to achieve we make pairs (1, 2) and (3, 4) and then clash the winners.

啊咧= =要注意类似这种题最好不过定性分析
之前的呢有一道母牛的题
牛的数量=现在牛的数量+能生牛的数量
同理
这道题:
比赛的局数=冠军和他将要比赛的人

//AC代码:
#include <iostream>
using namespace std;
int main()
{
    long long  n,f[1000];
    cin>>n;
    f[1]=1;
    f[2]=2;
    int b=2;
    while(n>=f[b]){
        ++b;
        f[b]=f[b-1]+f[b-2];
    }

    cout<<b-2<<endl;
}
<div class="search-result-card"><div class="xdRZvpyH"><div class="flex flex-col"><div class="qOjIXOD6 videoImage" style="padding-top: 133.333%;"><div class="KJZePflz"><div class="oyfanDG1"><div class="DSeU7aaq" style="background-image: url("https://p9-pc-sign.douyinpic.com/tos-cn-i-0813/oAAhAA72IVPBIAFxbvjZYEDDWsOS2ii8AQnPM~tplv-dy-cropcenter:323:430.jpeg?biz_tag=pcweb_cover&from=327834062&lk3s=138a59ce&s=PackSourceEnum_SEARCH&sc=cover&se=true&sh=323_430&x-expires=2069668800&x-signature=wURfD%2F7%2F828HaJQaqMIRGGmoDh4%3D");"></div><div class="DSeU7aaq" style="background-image: url("https://p9-pc-sign.douyinpic.com/tos-cn-i-0813/oAAhAA72IVPBIAFxbvjZYEDDWsOS2ii8AQnPM~tplv-dy-cropcenter:323:430.jpeg?biz_tag=pcweb_cover&from=327834062&lk3s=138a59ce&s=PackSourceEnum_SEARCH&sc=cover&se=true&sh=323_430&x-expires=2069668800&x-signature=wURfD%2F7%2F828HaJQaqMIRGGmoDh4%3D");"></div><div class="J70M5rRJ"></div><img src="https://p9-pc-sign.douyinpic.com/tos-cn-i-0813/oAAhAA72IVPBIAFxbvjZYEDDWsOS2ii8AQnPM~tplv-dy-cropcenter:323:430.jpeg?biz_tag=pcweb_cover&from=327834062&lk3s=138a59ce&s=PackSourceEnum_SEARCH&sc=cover&se=true&sh=323_430&x-expires=2069668800&x-signature=wURfD%2F7%2F828HaJQaqMIRGGmoDh4%3D" class="sAu48sAa Xn3cOytH" fetchpriority="high" width="1080" height="1440" decoding="async"></div><div class="uaGCrcWl"><div class="aTty6Dqz"><div class="bmTVuDbN"></div><div class="hICYZaIw">00:32</div><div class="LUd60iMQ"><svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" class="XpYL0ozp" viewBox="0 0 24 24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.224 4.667C6.326 4.667 4 7.151 4 10.043l.002.169a1.078 1.078 0 0 0-.002.094c.009.387.097.855.195 1.245.096.382.23.806.38 1.113.605 1.301 1.664 2.563 2.683 3.6a30.679 30.679 0 0 0 3.425 3.008l.02.017.015.012c.226.226.703.7 1.554.7h.025c.241 0 .816-.001 1.331-.502.009-.008.022-.02.042-.035l.182-.151.004-.004c.565-.465 1.886-1.554 3.188-2.867.834-.836 1.698-1.807 2.359-2.81.09-.136.176-.273.258-.41.033-.055.06-.112.082-.17.03-.077.044-.108.055-.13.013-.025.034-.063.088-.146.038-.06.07-.122.096-.188.037-.093.064-.156.085-.199l.004-.009c.087-.11.152-.238.19-.374.162-.576.273-1.082.284-1.705 0-.03 0-.058-.002-.087a7.123 7.123 0 0 0 .001-.206c-.019-2.876-2.338-5.341-5.224-5.341-1.094 0-2.159.339-2.999 1.021-.909-.658-1.957-1.021-3.097-1.021zm9.162 5.377v.134a2.388 2.388 0 0 0 0 .14c-.01.294-.057.559-.156.935-.043.07-.076.135-.1.186a4.313 4.313 0 0 0-.116.26c-.108.173-.178.31-.251.492-.05.082-.104.167-.16.252h-.001c-.55.834-1.304 1.69-2.087 2.476l-.003.002c-1.223 1.234-2.474 2.266-3.033 2.727l-.041.034c-.05.04-.105.086-.157.13l-.06-.061c-.065-.064-.154-.135-.197-.17l-.008-.006a28.517 28.517 0 0 1-3.214-2.817l-.003-.004c-.968-.985-1.824-2.042-2.27-3.009a4.077 4.077 0 0 1-.24-.719 4.491 4.491 0 0 1-.129-.715l.001-.036v-.098l-.001-.005-.002-.129c0-1.778 1.436-3.218 3.066-3.218.857 0 1.667.348 2.393 1.102a1.079 1.079 0 0 0 1.66-.129c.428-.61 1.155-.973 2.043-.973 1.63 0 3.066 1.441 3.066 3.218v.001z" fill="#fff"></path></svg><span>75.9万</span></div></div></div></div></div><div class="Rjle4CIM"><div class="wSEoiOKC"><div class="vqtFIVjM">此闹剧唯一受害者——围栏。#离谱 #万万没想到</div><div class="Yw1ttXGj"><span class="YebDknhI"><span class="AUcBf8QC">@</span><span class="VikzymRj">瓜瓜瓜妹</span></span><span class="wTD2qIyI"> · 2024年8月28日</span></div></div></div></div></div></div>有视频链接没有
最新发布
08-05
cypress从如下html中选择日期,选择一个可点击的日期 <div class="el-popper is-pure is-light el-picker__popper" tabindex="-1" aria-hidden="false" role="dialog" aria-modal="false" id="el-id-7743-192" data-popper-reference-hidden="false" data-popper-escaped="false" data-popper-placement="right" style="z-index: 2063; position: absolute; inset: 71.1111px auto auto 1113.78px;"><div class="el-picker-panel el-date-picker" actualvisible="true" unlinkpanels="false"><div class="el-picker-panel__body-wrapper"><!--v-if--><div class="el-picker-panel__body"><!--v-if--><div class="el-date-picker__header"><span class="el-date-picker__prev-btn"><button type="button" aria-label="前一年" class="d-arrow-left el-picker-panel__icon-btn"><i class="el-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"></path></svg></i></button><button type="button" aria-label="上个月" class="el-picker-panel__icon-btn arrow-left"><i class="el-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path></svg></i></button></span><span role="button" class="el-date-picker__header-label" aria-live="polite" tabindex="0">2025 年</span><span role="button" aria-live="polite" tabindex="0" class="el-date-picker__header-label">10 月</span><span class="el-date-picker__next-btn"><button type="button" aria-label="下个月" class="el-picker-panel__icon-btn arrow-right"><i class="el-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path></svg></i></button><button type="button" aria-label="后一年" class="el-picker-panel__icon-btn d-arrow-right"><i class="el-icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path fill="currentColor" d="M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"></path></svg></i></button></span></div><div class="el-picker-panel__content"><table aria-label="使用方向键与 Enter 键可选择日期" class="el-date-table" cellspacing="0" cellpadding="0" role="grid"><tbody><tr><!--v-if--><th aria-label="星期日" scope="col">日</th><th aria-label="星期一" scope="col">一</th><th aria-label="星期二" scope="col">二</th><th aria-label="星期三" scope="col">三</th><th aria-label="星期四" scope="col">四</th><th aria-label="星期五" scope="col">五</th><th aria-label="星期六" scope="col">六</th></tr><tr class="el-date-table__row"><td class="prev-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">28</span></div></td><td class="prev-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">29</span></div></td><td class="prev-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">30</span></div></td><td class="available" aria-selected="false" tabindex="0"><div class="el-date-table-cell"><span class="el-date-table-cell__text">1</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">2</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">3</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">4</span></div></td></tr><tr class="el-date-table__row"><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">5</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">6</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">7</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">8</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">9</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">10</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">11</span></div></td></tr><tr class="el-date-table__row"><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">12</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">13</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">14</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">15</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">16</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">17</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">18</span></div></td></tr><tr class="el-date-table__row"><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">19</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">20</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">21</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">22</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">23</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">24</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">25</span></div></td></tr><tr class="el-date-table__row"><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">26</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">27</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">28</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">29</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">30</span></div></td><td class="available" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">31</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">1</span></div></td></tr><tr class="el-date-table__row"><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">2</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">3</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">4</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">5</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">6</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">7</span></div></td><td class="next-month" aria-selected="false" tabindex="-1"><div class="el-date-table-cell"><span class="el-date-table-cell__text">8</span></div></td></tr></tbody></table><!--v-if--><!--v-if--></div></div></div><div class="el-picker-panel__footer" style="display: none;"><button aria-disabled="false" type="button" class="el-button el-button--small is-text el-picker-panel__link-btn"><!--v-if--><span class="">此刻</span></button><button aria-disabled="false" type="button" class="el-button el-button--small is-plain el-picker-panel__link-btn"><!--v-if--><span class="">确定</span></button></div></div><span class="el-popper__arrow" data-popper-arrow="" style="position: absolute; top: 165.333px;"></span></div>
07-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值