Algorithm
Problem Name: 2 AD-HOC - beecrowd | 2144
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2144
Bodybuilder
By Joao Marcos Salvanini Bellini de Moraes, IFSULDEMINAS Brazil
Timelimit: 1
BemBem is a famous bodybuilder. He's always seeking the perfect perfomance in his workouts in the gym to compete with his rivals. His friend Frenco assists him the best way possible, helping him seek the trapezius descendens and holding him from bringing down Ibirapuera Park's trees. Nevertheless, BemBem called you to help him in a specific task: to determine his 1RM (one-repetition maximum) average. To do this, you can use the following formula:
W = Weight to be lifted.
R = Number of repetitions.
However, one of BemBem's arm is weaker than the other, which makes him lift less weight with it, and that's why he asked for your help, claiming that "the crazy one is sick". Help him and become a codebuilder!
Input
The input contains the integers W1 (weight lifted by his left arm: 1 ≤ W1 ≤ 60), W2 (weight lifted by his right arm: 1 ≤ W2 ≤ 100) and R (number of repetitions: 1 ≤ R ≤ 12). Read input until W1 = W2 = R = 0.
Output
Print the catch phrase that corresponds to his 1RM average (M - floating point) according to the following table:
If the average of all test cases is greater than 40, print a blank line, then print "Aqui nois constroi fibra rapaz! Nao e agua com musculo!".
Input Sample | Output Sample |
1 2 1 50 84 6 30 49 8 11 12 5 16 30 10 44 55 11 0 0 0 |
Nao vai da nao AQUI E BODYBUILDER!! Ta saindo da jaula o monstro! E 13 Bora, hora do show! BIIR! AQUI E BODYBUILDER!! Aqui nois constroi fibra rapaz! Nao e agua com musculo! |
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
double W1, W2, R, acumulacao=0.0;
int qtd=0;
while(cin >> W1 >> W2 >>R ){
double esq, dir;
double media;
if(qtd !=0)
cout<<endl;
if(W1+W2+R == 0)
break;
esq = W1*(1+ R/30);
dir = W2*(1+ R/30);
media = (esq+dir)/2;
acumulacao+=media;
qtd++;
if(media>=1 && media < 13>{
cout << "Nao vai da nao";
}
if(media>=13 && media <14>{
cout << "E 13";
}
if(media>=14 && media <40>{
cout << "Bora, hora do show! BIIR!" ;
}
if(media>=40 && media <=60>{
cout << "Ta saindo da jaula o monstro!" ;
}
if(media>60){
cout << "AQUI E BODYBUILDER!!" ;
}
}
if((acumulacao/qtd)>40){
cout<<"\n";
printf("Aqui nois constroi fibra rapaz! Nao e agua com musculo!\n");
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
50 84 6
30 49 8
11 12 5
16 30 10
44 55 11
0 0 0
Output
AQUI E BODYBUILDER!!
Ta saindo da jaula o monstro!
E 13
Bora, hora do show! BIIR!
AQUI E BODYBUILDER!!
Aqui nois constroi fibra rapaz! Nao e agua com musculo!