Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int x = 0, z = 0, t = 0, aux = 0;
- double tempo[100]; double aux1 = 0; double maior; int sistema[100]; int intmaior1;
- scanf("%d", &x);
- for (t = 0; t < x; ++t)
- {
- scanf("%lf", &tempo[t]);
- }
- //ordenacao de array
- for (t = 0; t < x; ++t)
- {
- aux = t;
- for (z = t + 1; z < x; ++z)
- {
- if(tempo[z] > tempo[aux])
- {
- aux = z;
- }
- }
- aux1 = tempo[t];
- tempo[t] = tempo[aux];
- tempo[aux] = aux1;
- }
- //fim ordenacao
- for (t = 0; t < x; ++t)
- {
- sistema[t] = tempo[t] * 10;
- }
- maior = tempo[0];
- int cont = x - 1, contador = 0; double maior1 = 0;
- maior1 = maior; intmaior1 = maior1;
- while(cont > 0)
- {
- for(t = 1; t < x; ++t)
- {
- if(sistema[t] == 0)
- {
- printf("SEM RESPOSTA");
- }
- else if(intmaior1 % sistema[t] == 0)
- {
- contador++;
- }
- }
- if(contador == cont)
- {
- maior1 = intmaior1;
- printf("O tempo para o alinhamento dos planetas e %.1lf minutos", maior1);
- return 0;
- } else{
- intmaior1 += maior;
- t = 1; contador = 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement