-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31871ad
commit 4bbbdd1
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
|
||
int cont = 0; | ||
|
||
int verifica(int pior_caso, int melhor_caso){ | ||
int valor; | ||
float aux; | ||
valor = (melhor_caso + pior_caso)/2; | ||
if(valor <= pior_caso-1){ | ||
cont++; | ||
return(verifica(valor,melhor_caso)); | ||
} | ||
else{ | ||
if(pior_caso%2 == 0){ | ||
cont++; | ||
} | ||
return(printf("%d\n",cont)); | ||
} | ||
} | ||
|
||
int main(){ | ||
int maximo, minimo, baloes; | ||
minimo = 0; | ||
scanf("%d %d",&maximo,&baloes); | ||
verifica(maximo,minimo); | ||
return(EXIT_SUCCESS); | ||
} |