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, j; //Iterators
- unsigned long long 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 -1;
- if (Va == 0 || Va > 400)
- return -1;
- if (Vb == 0 || Vb > 400)
- return -1;
- if (T > 200)
- return -1;
- if (D >= C)
- return -1;
- C *= 100; //Meters to centimeters
- D *= 100;
- Pa = D; Pb = D;
- T *= 60; //Minutes to seconds
- 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;
- default:
- return -1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement