codeforces 735 C Tennis Championship
来源:互联网 发布:龙bt发布永久域名 编辑:程序博客网 时间:2024/05/22 17:01
题目描述:
Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will ben 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 playeddiffers 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.
The only line of the input contains a single integer n (2 ≤ n ≤ 1018) — the number of players to participate in the tournament.
Print the maximum number of games in which the winner of the tournament can take part.
2
1
3
2
4
2
10
4
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 players2 and 3.
In the third sample, player 1 can't play with each other player as after he plays with players2 and 3 he can't play against player4, as he has 0 games played, while player1 already played 2. Thus, the answer is2 and to achieve we make pairs (1, 2) and (3, 4) and then clash the winners.
题目描述:
一个bt的斐波拉契数列 ,运算两次,详看代码
AC代码:
#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<cmath>#include<algorithm>using namespace std;const long long int maxn=105;long long int v[maxn];init(){ v[0]=0; v[1]=1; v[2]=1; for(long long int i=3;i<maxn;i++) v[i]=v[i-1]+v[i-2]; for(long long int i=1;i<maxn;i++) v[i]+=v[i-1];}int main(){ init(); long long int n; while(~scanf("%lld",&n)) { for(long long int i=1;i<maxn;i++) { if(v[i]>=n) { printf("%lld\n",i-1); break; } } } return 0;}
- codeforces 735c Tennis Championship
- CodeForces 735C Tennis Championship
- codeforces 735 C Tennis Championship
- CodeForces 735C Tennis Championship
- codeforces 735C/382.2.C Tennis Championship
- CodeForces 735C - Tennis Championship(递推)
- Codeforces 735C - Tennis Championship 规律
- codeforces 735 C. Tennis Championship (数学)
- 【Codeforces 735 C Tennis Championship】+ 贪心
- CodeForces 735 C.Tennis Championship(水~)
- 735C Tennis Championship
- Codeforces #382 C Tennis Championship
- codeforces 735C Tennis Championship 思维+递推
- 【17.76%】【codeforces round 382C】Tennis Championship
- Tennis Championship CodeForces
- CF 735C Tennis Championship dp,Fib
- Codeforces Round #382 (Div. 2)-735C. Tennis Championship(递推)
- Codeforces#382(Div. 2) C.Tennis Championship【递推】
- 使用gdb调试内嵌汇编的代码
- opencv视频转图片并保存到文件夹下
- 最简实例说明wait、notify、notifyAll的使用方法
- LeetCode-38. Count and Say-思路详解-C++
- stl之std::alloctor 配置器源码
- codeforces 735 C Tennis Championship
- ADB环境变量配置
- Android Camera使用总结与那些坑
- R语言xgboost自定义目标函数
- 【JZOJ3839】Baby Step
- 2 Python 利用socket实现的服务端和客户端
- 找出符合以下条件的Troitsky数,将该数的首位数字移动到末位数字之后得到的数是原数的整数倍 例如:将142857的首位数字1移动到末位之后得到的数是428571,而428571=3*1
- hdu 5997 rausen loves cakes [启发式合并+树状数组/线段数]【杂类+数据结构】
- listview数据刷新分析(三)