Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- //#pragma comment(linker, "/STACK:100000000")
- #include <algorithm>
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <string>
- #include <cstring>
- #include <set>
- #include <stdio.h>
- #include <vector>
- #include <map>
- #include <time.h>
- #include <memory.h>
- #define ll long long
- #define ld long double
- #define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
- #define FORN(i, b) for(int i=0; i<(int) (b); i++)
- #define FORZ(i, a, b) for (int i=(int)(a); i>=(int)(b); --i)
- #define mp make_pair
- #define fs first
- #define sc second
- #define pii pair<int, int>
- #define plenn pair<lenn, lenn>
- #define vii vector<int>
- #define vlenn vector<lenn>
- #define pb push_back
- #define bg begin()
- #define ed end()
- #define rsz resize
- #define ext return 0;
- #define pi 3.141592653589793238462643383279
- //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)); }
- //lenn lcm(lenn a, lenn b) { return ((a *b / gcd(a, b))); }
- int sqr(int x) { return (x*x); }
- #define MAX 1000010 //53
- #define INF 1000000007
- #define y1 yy1
- #define eps 0.0000000001
- void out(){ puts("NO"); exit(0); }
- #define ls (v << 1)
- #define rs (v << 1)+1
- using namespace std;
- int n;
- struct Item{
- int x, num;
- } a[50];
- string s;
- bool used[50];
- bool cmp(Item a, Item b){
- return a.x < b.x;
- }
- int main(){
- int loosers = 0;
- FORN(j, 4) {
- cin >> n;
- a[j].x = 0;
- FORN(i, n) {
- cin >> s;
- if (s[0] >= '6' && s[0] <= '9') a[j].x += s[0] - '0'; else
- if (s[0] == 'T') a[j].x += 10; else
- if (s[0] == 'J') a[j].x += 2; else
- if (s[0] == 'Q') a[j].x += 3; else
- if (s[0] == 'K') a[j].x += 4; else
- if (s[0] == 'A') a[j].x += 11;
- }
- scanf("\n");
- if (a[j].x > 21) used[j] = true, loosers++;
- a[j].num = j;
- }
- if (loosers == 4) {
- cout << "DRAW\n";
- return 0;
- }
- sort(a, a + 4, cmp);
- int i = 0;
- while (i < 4 && used[a[i].num]) i++;
- if (i == 4) cout << "DRAW"; else
- {
- int et = i;
- for (++i; i < 4; i++) {
- if (used[a[i].num]) continue;
- if (a[i].x == a[et].x) {
- cout << "DRAW\n";
- return 0;
- }
- if (a[i].x>a[et].x) et = i;
- }
- string ans[] = { "Leonardo", "Raphael", "Donatello", "Michelangelo" };
- cout << ans[a[et].num];
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement