Created
July 11, 2016 21:20
-
-
Save KhaledElshamy/2f59887fa7a8a1508723c2dfa64ad8e0 to your computer and use it in GitHub Desktop.
URI ONLINE JUDGE 1160
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
#include <stdio.h> | |
int main(void) { | |
int T, pa, pb, i, count; | |
double g1, g2; | |
scanf("%d", &T); | |
for (i = 1;i <= T;i++) | |
{ | |
count = 0; | |
scanf("%d %d %lf %lf", &pa, &pb, &g1, &g2); | |
for (;;) | |
{ | |
(double)pa; | |
(double)pb; | |
pa = ((pa*g1) / 100) + pa; | |
pb = ((pb*g2) / 100) + pb; | |
count++; | |
if (pa > pb) | |
break; | |
} | |
if (count <= 100) | |
{ | |
printf("%d anos.\n", count); | |
} | |
else | |
{ | |
printf("Mais de 1 seculo.\n"); | |
} | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment