Advertisement
juanjo12x

UVA_12502_Three_Families

Aug 10th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <cctype>
  7. #include <stack>
  8. #include <queue>
  9. #include <list>
  10. #include <vector>
  11. #include <map>
  12. #include <set>
  13. #include <sstream>
  14. #include <stdlib.h>
  15. #include <cmath>
  16. #define LL unsigned long long
  17. using namespace std;
  18.  
  19. int main ()
  20. {
  21.     int testCases; scanf ("%d", &testCases);
  22.  
  23.     while ( testCases-- ) {
  24.         int x, y, z;
  25.         scanf ("%d %d %d", &x, &y, &z);
  26.  
  27.         int totalWorkHour = x + y;
  28.         int totalWorkMinute = totalWorkHour * 60;
  29.         int eachShareMinute = totalWorkMinute / 3;
  30.         int familyAExtraMinute = x * 60 - eachShareMinute;
  31.         if ( familyAExtraMinute <= 0 ) printf ("0\n");
  32.         else printf ("%d\n", (z * familyAExtraMinute) / eachShareMinute);
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement