Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. //#pragma comment(linker, "/STACK:100000000")
  3. #include <algorithm>
  4. #include <iostream>
  5. #include <iomanip>
  6. #include <cmath>
  7. #include <string>
  8. #include <cstring>
  9. #include <set>
  10. #include <stdio.h>
  11. #include <vector>
  12. #include <map>
  13. #include <time.h>
  14. #include <memory.h>
  15.  
  16. #define ll long long
  17. #define ld long double
  18. #define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
  19. #define FORN(i, b) for(int i=0; i<(int) (b); i++)
  20. #define FORZ(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
  21. #define mp make_pair
  22. #define fs first
  23. #define sc second
  24. #define pii pair<int, int>
  25. #define plenn pair<lenn, lenn>
  26. #define vii vector<int>
  27. #define vlenn vector<lenn>
  28. #define pb push_back
  29. #define bg begin()
  30. #define ed end()
  31. #define rsz resize
  32. #define ext return 0;
  33. #define pi 3.141592653589793238462643383279
  34. //lenn gcd(lenn a, lenn b) { if (a == 0 || b == 0) return (a + b); if (a > b) return (gcd(a%b, b)); return (gcd(a, b % a)); }
  35.  
  36. //lenn lcm(lenn a, lenn b) { return ((a *b / gcd(a, b))); }
  37. int sqr(int x) { return (x*x); }
  38.  
  39. #define MAX 1000010 //53
  40. #define INF 1000000007
  41. #define y1 yy1
  42. #define eps 0.0000000001
  43. void out(){ puts("NO"); exit(0); }
  44.  
  45. #define ls (v << 1)
  46. #define rs (v << 1)+1
  47. using namespace std;
  48.  
  49. int n;
  50. struct Item{
  51. int x, num;
  52. } a[50];
  53. string s;
  54. bool used[50];
  55.  
  56. bool cmp(Item a, Item b){
  57. return a.x < b.x;
  58. }
  59.  
  60. int main(){
  61. int loosers = 0;
  62. FORN(j, 4) {
  63. cin >> n;
  64. a[j].x = 0;
  65. FORN(i, n) {
  66. cin >> s;
  67. if (s[0] >= '6' && s[0] <= '9') a[j].x += s[0] - '0'; else
  68. if (s[0] == 'T') a[j].x += 10; else
  69. if (s[0] == 'J') a[j].x += 2; else
  70. if (s[0] == 'Q') a[j].x += 3; else
  71. if (s[0] == 'K') a[j].x += 4; else
  72. if (s[0] == 'A') a[j].x += 11;
  73. }
  74. scanf("\n");
  75. if (a[j].x > 21) used[j] = true, loosers++;
  76. a[j].num = j;
  77. }
  78. if (loosers == 4) {
  79. cout << "DRAW\n";
  80. return 0;
  81. }
  82. sort(a, a + 4, cmp);
  83. int i = 0;
  84. while (i < 4 && used[a[i].num]) i++;
  85. if (i == 4) cout << "DRAW"; else
  86. {
  87. int et = i;
  88. for (++i; i < 4; i++) {
  89. if (used[a[i].num]) continue;
  90. if (a[i].x == a[et].x) {
  91. cout << "DRAW\n";
  92. return 0;
  93. }
  94. if (a[i].x>a[et].x) et = i;
  95. }
  96. string ans[] = { "Leonardo", "Raphael", "Donatello", "Michelangelo" };
  97. cout << ans[a[et].num];
  98. }
  99. cout << endl;
  100.  
  101. return 0;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement