#include <stdio.h>
#include <stdlib.h>

questao1(){
	int num;
	int b0, b1, b2, b3, b4, bParidade;
	int novoNum;
	
	printf("Informe o numero a ter a paridade verificada: \n");
	scanf("%d", &num);
	
	b0 = num % 2;
	b1 = (num / 2) % 2;
	b2 = (num / 4) % 2;
	b3 = (num / 8) % 2;
	b4 = (num / 16);

	bParidade = (b0 + b1 + b2 + b3 + b4) % 2;

	novoNum = b4 * 32 + b3 * 16 + b2 * 8 +
			  b1 * 4 + b0 * 2 + bParidade;

	printf("%d = (%d%d%d%d%d)2\n", num, b4, b3, b2, b1, b0);
	printf("%d = (%d%d%d%d%d%d)2\n", novoNum, b4, b3, b2, b1, b0, bParidade);	
}

questao2(){
	int atk1, atk2, atk3;
	int max10 = 0;
	int par = 0;
	int atk0 = 0;
	
	printf("Informe o valor dos tres ataques:\n");
	scanf("%d %d %d", &atk1, &atk2, &atk3);
	
	if(atk1 % 2 == 0 || atk2 % 2 == 0 || atk3 % 2 == 0)
		par = 1;
	if(atk1 > 10 || atk2 > 10 || atk3 >= 10) 
		max10 = 1;
	if(atk1 == 0 || atk2 == 0 || atk3 == 0)	
		atk0 = 1;
	
	if(par == 1 && max10 == 1 && atk0==0)
	  printf("Biu Vence\n");
	else  	
	  printf("Rattata Vence\n");
}

questao3(){
	int horario;
	int hh, mm, ss, cc;
	int totalCentesimos = (((24 * 60)*60) * 100);
	int horarioCentesimos;
	int hh100, mm100, ss100, cc100;
	
	float razaoDecimal;
	int horarioDecimal;
	
	printf("Informe o horario no formato tradicional\n");
	scanf("%d", &horario);
	hh = (horario / 1000000);
	mm = ((horario % 1000000) / 10000);
	ss = ((horario % 10000) / 100);
	cc = horario % 100; 
	printf("%dh%dm%ds%d/100\n", hh, mm, ss, cc);
	
	horarioCentesimos = (hh * 60);
	horarioCentesimos = ((horarioCentesimos + mm) * 60);
	horarioCentesimos = ((horarioCentesimos + ss) * 100);
	horarioCentesimos += cc;
	
	razaoDecimal = ((float)horarioCentesimos) / totalCentesimos;
	
	horarioDecimal = 10000000 * razaoDecimal;

	hh100 = (horarioDecimal / 1000000);
	mm100 = ((horarioDecimal % 1000000) / 10000);
	ss100 = ((horarioDecimal % 10000) / 100);
	cc100 = horarioDecimal % 100; 
	
	printf("%d\n", horarioDecimal);
	printf("%dh%dm%ds%d/100\n", hh100, mm100, ss100, cc100);
}

main() {
  questao3();
}
