国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

【Codeforces 735 C Tennis Championship】+ 貪心

2019-11-11 06:42:00
字體:
來源:轉載
供稿:網友

C. Tennis Championship time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

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

得分為n的人與得分為n - 1的比賽才能使比賽次數最大化,多少人才能出一個得分為N的人呢?

AC代碼:

#include<cstdio>typedef long long LL;int main(){ LL N,l = 1, r = 1,num = 0,t; scanf("%lld",&N); while(l + r <= N) t = l,l = r,r = t + r,num++; printf("%lld/n",num); return 0;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 郑州市| 桑日县| 惠东县| 盐城市| 长岭县| 贡嘎县| 云阳县| 景宁| 吉林省| 独山县| 东城区| 商河县| 六枝特区| 贞丰县| 上林县| 襄樊市| 隆子县| 吉木乃县| 福安市| 霍邱县| 南宫市| 涡阳县| 呼图壁县| 上饶县| 亳州市| 九龙坡区| 白城市| 蒙山县| 深州市| 三穗县| 金沙县| 都匀市| 黄骅市| 原平市| 吴堡县| 青神县| 阿克| 永春县| 沂水县| 河曲县| 怀柔区|