Codeforces Round #382 (Div. 2), problem: (C) Tennis Championship Solution in C/C++

#include<stdio.h>
main()
{
	long long int n,i,j,c=0,a,b,k;
	scanf("%I64d",&n);
	a=1;
	b=1;
	k=a+b;
	while(k<=n)
	{   c++;
	    a=b;
	  	b=k;
	  k=a+b;	
	}
	printf("%I64d",c);
}
(Visited 149 times, 1 visits today)

About the Author:

Taniv Ashraf

Leave A Comment