Codeforces Round #382 (Div. 1) A. Tennis Championship

ADB 安装教程:如何在 Windows、 Linux 上安装 Android Debug Bridge 本文介绍了在Windows和Linux系统上安装ADB(Android调试桥)的方法。对于Windows系统:1)从官网下载ADB工具并解压;2)通过命令提示符验证安装;3)配置环境变量以实现全局使用;4)再次验证全局ADB功能。Linux系统可通过包管理器直接安装(如Ubuntu使用apt,Fedora使用dnf),安装后同样需验证版本信息确认成功。两种系统安装完成后,都能通过"adb version"命令检查安装状态。 阅读详情


A. 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个人打淘汰赛。一旦输了就淘汰。只有已比赛次数相差<=1的人才能比赛,问胜者最多能赢几场。

思路:基本上手推几下就能知道其中的原理然后明白是斐波那契数列。。然后就是一道水题了。

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cmath>
#include<queue>
#include<string>
#include<functional>
typedef long long LL;
using namespace std;
#define maxn 105
#define ll l,mid,now<<1
#define rr mid+1,r,now<<1|1
#define lson l1,mid,l2,r2,now<<1
#define rson mid+1,r1,l2,r2,now<<1|1
#define pi acos(-1.0)
#define inf 0x3f3f3f3f
const int mod = 1e9 + 7;
int main(){
	LL a[maxn];
	a[0] = a[1] = 1;
	int i = 2, end;
	while (1){
		a[i] = a[i - 1] + a[i - 2];
		if (a[i]>1000000000000000000ll){
			end = i;
			break;
		}
		i++;
	}
	LL n;
	while (~scanf("%lld", &n)){
		for (int i = 1; i <= end; i++){
			if (a[i] > n){
				printf("%d\n", i - 2);
				break;
			}
		}
	}
}


手把手教你学simulink(41.4)--逆变器电场景示例:基于Simulink的主从控制的多逆变器协同控制(Multi-Inverter Coordinated Control) 需求分析在现代电力系统中,分布式发电和储能系统的广泛应用使得多个逆变器并联运行成为常见的应用场景。为了确保多个逆变器之间的协同工作,实现系统的稳定性和高效性,通常采用主从控制(Master-Slave Control)策略。主从控制通过一个主控制器(Master)来协调多个从控制器(Slave),确保所有逆变器的输出电压、频率和功率分配符合预期目标。本项目将基于Simulink平台,开发一个多逆变器协同控制系统,采用主从控制策略,实现对多个逆变器的精确控制和优化。 阅读详情

相关推荐

Java开发者必看:WPS Office在线预览接入实战(含回调配置避坑指南)

本文为Java开发者提供了WPS Office在线预览功能的完整接入实战指南。详细解析了从服务申请、生成带签名的访问URL,到实现核心回调接口(文件信息、用户信息、文件保存)的全流程,并重点分享了签名算法与回调配置中的关键避坑点,帮助开发者高效集成,提升Web应用文档处理体验。

vodka的博客 1328

c语言网球比赛大全,codeforce 735 C. Tennis Championship (斐波那契数列||网球比赛)...

题意:问你冠军最多能赢多少场比赛,然后一个人只能和赢得场数最多相差一的人进行比赛,如果一个人输掉了比赛,那么他就失去了继续比赛的资格。思路:这题的突破口已经很明显暗示你了,最多相差一个人 才能进行比赛, 那我们可以考虑 冠军打n场比赛最少要几个人, 那么很容易想到这个一个斐波那契数列Famous Brazil city Rio de Janeiro holds a tennis tournamen...

weixin_30972131的博客 249

Adversarial Texture for Fooling Person Detectors in the Physical World

本文提出了对抗纹理的想法(AdvTexture),与基本补丁攻击不同对抗纹理可以生成任意大小,可以覆盖任意大小的不了,并且纹理的任何局部都有对抗性的效果。当衣服被对抗纹理覆盖是,摄像头捕捉到的每一个局部区域都可以攻击探测器,这成功解决了片段缺失的问题。提出了一种两阶段生成方法:基于环形收割的可扩展生成攻击(TC-EGA)来制作广告纹理。第一阶段,训练一个全卷积网络FCN作为生成器,通过采样随机潜变量作为输入来产生纹理(不同于GAN中传统的生成器架构,每一层都使用卷积运算)......

weixin_49171105的博客 1067

Codeforces Round #382 (Div. 2) -- C. Tennis Championship (数学找规律 -- 斐波那契数列)

大体题意: n 个人进行比赛,问你一个做多打多少场比赛? 两个人进行比赛,它们比赛场次之差不差过1,否则不能打,一旦一个人打比赛输了,就不能继续往后打了! 思路: 很水的一道题目,想复杂了! 其实是一个找规律的题目。 当你写出几个数据来后,就能猜出来了: 2 3 4 5 6 7 8 9 10 11 12 13 1 2 2 3 3 3 4 4  4  4  4   5 下面同一类的个

aozil_yang的博客 682

FCN---训练cityspaces

未经允许,不要随意转载! 最近想试试用FCN训练自己的数据集,想想标注是一件很费劲的事,于是就想到了用其他库里的数据,这里选用了cityspaces,默认已经配置好FCN. 1、下载cityspaces https://www.cityscapes-dataset.com/ 需要注册一个账号 cityspaces包含2...

wangyu088的专栏 2031

使用cartographer纯定位替换amcl定位

经过实际使用,发现cartographer定位对于重定位的表现比amcl好。如果机器人的起始位置离原点较远,amcl很难自行重定位到正确的位置,只能手动修改初始位置。然而cartographer定位的表现则很好,在行驶一段距离或原地旋转一段时间后能够正确重定位。

XJ_75的博客 8313

Codeforces Round #382 (Div. 2) C. Tennis Championship(斐波那契递推)

题目链接:http://codeforces.com/contest/735/problem/CC. Tennis Championship time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Famous Brazil city

linlinsong—ACM界蒟水! 537

自然二进制数与格雷码的相互转换

自然二进制数与格雷码两者优势: 自然二进制数的编码方式简单明了,容易理解,在加减运算中能够直接进行,同时十分方便进行一些位运算操作(如移位、取反等)。 格雷码计数时只有一位变化,可有效减少计数器状态的冗余转换,同时在传输数据时能够减小传输错误的概率,此外带权重编码处理更加方便。 在一定程度上自然二进制数与格雷码优缺点基本相反,综上所述,自然二进制数和格雷码各有优劣之处,需要根据具体应用场景选择合适的编码方式。简单来说,在计数器和编码器中,倾向于使用格雷码;而在进行加减运算时,则倾向于使用自然二进制数。

Loudrs的博客 7493

CodeForces - 735C Tennis Championship(思维+fib数列)

CodeForces - 735C Tennis Championship   题意:一个淘汰赛制比赛,规定比赛的双方的胜场不超过一场,输入人数,输出冠军能够参加的最大比赛场数   思路:一开始没有注意比赛双方胜场不超过一场,错,转变一下思维,用 F[i] 数组表示最大比赛场数为 i 场时所需要的最小人数, 在冠亚军比赛之前冠军赢了 i  - 1 场,并且与冠军比赛的人和与亚

GYH0730的博客 653

【AI应用实战-Codex】Mac intel芯片下安装Codex(二)

摘要:本文介绍了在Intel芯片Mac上安装OpenAI Codex桌面应用时遇到的问题及解决方法。由于官方仅提供ARM64版本,导致Intel Mac无法直接运行。解决方案包括:1)使用社区脚本将ARM版DMG与x64 Electron重新打包成兼容版本;2)使用VSCode插件配合CLI作为替代方案。文章详细记录了重新打包过程中遇到的"electron_common_owl_features"绑定缺失错误,通过注入stub代码、重算ASAR完整性哈希等步骤成功解决问题。最终生成的Co

3528

CAN(2)-GD32

GD32中CAN的特征。

小柚子的博客 553

codeforces 735C Tennis Championship 思维+递推

点击打开链接 题意:两个人能比赛要求胜场差 转换一下思维 令f[x]为冠军赢x场比赛时最少的参赛人数,则f[x]=f[x-1]+f[x-2] (让赢x-1场的去赢x-2场的)  输入n 二分找到n>=f[x]的最大x即可  #include #include #include #include typedef long long ll; using namespace std;

Masamiiiiii 806

(10)三相三绕组变压器的建模仿真

建立了三相三绕组变压器组的Simulink仿真模型,通过实例进行了仿真计算。

weixin_45670943的博客 1143

Codeforces Round #382 (Div. 1) 736A Tennis Championship【找规律】

题目传送门:点击打开链接A. Tennis Championshiptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFamous Brazil city Rio de Janeiro holds a tennis tournament and ...

Emiya丶的博客 746

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Codeforces Round #382 (Div. 1) A. 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 fro

WZJRJ28 386

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Codeforces Round #382 (Div. 2)C. Tennis Championship(贪心)

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 ho

fouzhe的博客 743

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Codeforces Round #382 (Div. 2) C - Tennis Championship

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 tenn

无常是生活的常态 651

Codeforces Round #382C. Tennis Championship(递推+斐波那契数列)

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 ho

Rain 615

Codeforces Round #382 (Div. 2) Tennis Championship (斐波那契)

题意:n个人两两PK,赢了留下,输了淘汰,问最后赢的人获胜需要的最大场数 思路:令f[i]为赢i场需要的人数,容易发现是一个斐波那契....然后就做完了 #include using namespace std; #define LL long long LL fic[105]; void init() { fic[0]=0; fic[1]=1; fic[2]=2; for(i

围巾的ACM博客 326

Codeforces Round #382 (Div. 2)-C. Tennis Championship

原题链接 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

L. 324

Codeforces Round #382 (Div. 2) C. Tennis Championship

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

weixin_30852367的博客 107

Codeforces Round #382 (Div. 2) C. Tennis Championship 斐波那契

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

weixin_30580943的博客 133

Codeforces Round #382 (Div. 2)-735C. Tennis Championship(递推)

C. Tennis Championship time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Famous Brazil city Rio de Janeiro holds a tennis tournament and Ost

Prim 679

Codeforces Round #382 (Div. 2)C. Tennis Championship(递推,斐波那契)

C. Tennis Championshiptime limit per test:2 secondsmemory limit per test:256 megabytesinput:standard inputoutput:standard outputFamous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Ben

妍恐龙的博客....^~^眼熟我 311

Codeforces Round #382 (Div. 2)C. Tennis Championship 动态规划

C. Tennis Championship 题目链接 http://codeforces.com/contest/735/problem/C 题面 Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be n...

weixin_34306593的博客 79

Codeforces Round #382 (Div. 2)A到D题 A. Ostap and //B. Urbanization//C. Tennis Championship//D. Taxes

A. Ostap and Grasshopper time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output On the way to Rio de Janeiro Ostap

jerans的博客 1287
上一篇: Codeforces Round #381 (Div. 2) B. Alyona and flowers
下一篇: Codeforces Round #382 (Div. 1) B. Taxes
overload1997
博客等级 码龄11年 328粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值