Advertisement
Guest User

COJ 1358

a guest
Sep 21st, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.35 KB | None | 0 0
  1. /*
  2.     By: Luchomatic
  3.     From: La Plata Buenos Aires Argentina
  4.     Name: Luciano Castro
  5.     Date: 21/09/2014
  6. */
  7.  
  8. #include <iostream>
  9. #include <cstdio>
  10. #include <cstdlib>
  11. #include <string>
  12. #include <cstring>
  13. #include <cmath>
  14. #include <algorithm>
  15. #include <vector>
  16. #include <queue>
  17. #include <deque>
  18. #include <set>
  19. #include <map>
  20. #include <iterator>
  21. #include <utility>
  22. #include <list>
  23. #include <stack>
  24. #include <iomanip>
  25.  
  26.  
  27. #define MAX_INT 2147483647
  28. #define MAX_LONG 9223372036854775807ll
  29. #define MAX_ULONG 18446744073709551615ull
  30. #define MAX_DBL 1.7976931348623158e+308
  31. #define EPS 1e-9
  32. #define _log2(x) log(x) * 1.44269504088896340736
  33. //const long double PI = 2*acos(0);
  34.  
  35. #define INF 1000000000
  36.  
  37. int n, naux;
  38. char s[1000];
  39. char smax[1000];
  40. char smin[1000];
  41. int maxi, mini, total;
  42. int a[5], i;
  43.  
  44. int main () {
  45.     scanf ("%d", &n);
  46.     mini=99999;
  47.     maxi=-1;
  48.     while (n!=-1){
  49.         while (n--){
  50.             scanf ("%s", &s);
  51.             scanf ("%d", &a[0]);
  52.             scanf ("%d", &a[1]);
  53.             scanf ("%d", &a[2]);
  54.             total=((a[0]*5)+(a[1]*10)+(a[2]*20));
  55.             if (total>maxi){
  56.                 maxi=total;
  57.                 smax=s;
  58.             }
  59.             if (total<mini){
  60.                 mini=total;
  61.                 smin=s;
  62.             }
  63.         }
  64.         if (mini==maxi){
  65.             printf("All have the same amount.\n");
  66.         }else{
  67.             printf ("%s has most, ", smax);
  68.             printf ("%s has least money.\n", smin);
  69.         }
  70.     scanf ("%d", &n);
  71.     mini=99999;
  72.     maxi=-1;
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement