Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * URI Online Judge | 1964
- * Author: Kaio KDOXG
- * Federal University of Pelotas, 2020
- *
- */
- #include <stdio.h>
- #define A "Ana"
- #define B "Bia"
- int main()
- {
- unsigned long long Pa, Pb; //A's and B's position
- unsigned long long i; //Iterator
- unsigned choice; //Final choice
- unsigned long long C;
- unsigned long long Va, Vb;
- unsigned long long T;
- unsigned long long D;
- scanf("%llu%llu%llu%llu%llu", &C, &Va, &Vb, &T, &D);
- if (C == 0 || C > 1000)
- return 0;
- if (Va == 0 || Va > 400)
- return 0;
- if (Vb == 0 || Vb > 400)
- return 0;
- if (T > 200)
- return 0;
- if (D >= C)
- return 0;
- Pa = D; Pb = D;
- T *= 60; //Minutes to seconds
- Va /= 100; Vb /= 100; //Centimeters to meters
- for (i=100; i<T; i++)
- {
- Pa += Va;
- if (Pa >= C)
- Pa -= C;
- Pb += Vb;
- if (Pb >= C)
- Pb -= C;
- }
- while (1)
- {
- Pa += Va;
- Pb += Vb;
- if (Pa >= C || Pb >= C)
- {
- choice = Pb > Pa ? 1 : 0;
- break;
- }
- }
- switch(choice)
- {
- case 0:
- printf("%s", A);
- break;
- case 1:
- printf("%s", B);
- break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement