Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Created May 25, 2017 15:25
Show Gist options
  • Save rogerioagjr/18bfe8829a57ab8719b7a3146b271f00 to your computer and use it in GitHub Desktop.
Save rogerioagjr/18bfe8829a57ab8719b7a3146b271f00 to your computer and use it in GitHub Desktop.
Teleférico
// Teleférico - F1P1 - OBI 2017
// Rogério Júnior
// Complexidade: O(1)
#include <cstdio> // scanf e printf
int main(){
// declaro e leio os valores de C e A
int c, a;
scanf("%d %d", &c, &a);
// o número de viagens começa com a quantidade de viagens
// em que o bonde vai totalmente lotado
int v=(c-1)/a;
// se ainda sobrarem alunos, adiciono mais uma viagem
if((c-1)%a!=0) v++;
// por fim, imprimo o número final de viagens
printf("%d\n", v);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment