-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1248.cpp
84 lines (84 loc) · 2.31 KB
/
1248.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include<stdio.h>
#include<algorithm>
using namespace std;
inline int count(int a[]){
if(a[1]==a[2]&&a[2]==a[3])
return 3;
if(a[1]==a[2]||a[2]==a[3])
return 2;
return 1;
}
int main(){
int k,same1,same2,i,cnt1,cnt2;
int a[5],b[5];
scanf("%d",&k);
while(k--){
for(i=1;i<=3;i++){
scanf("%d",&a[i]);
if(a[i]==1)
a[i]=7;
}
for(i=1;i<=3;i++){
scanf("%d",&b[i]);
if(b[i]==1)
b[i]=7;
}
sort(a+1,a+4);
sort(b+1,b+4);
same1=count(a);
same2=count(b);
if(same1>same2)
printf("Alice\n");
else if(same1<same2){
printf("Bob\n");
}
else {
if(same1==3){
if(a[1]>b[1])
printf("Alice\n");
else if(a[1]<b[1])
printf("Bob\n");
else
printf("Draw\n");
}
else if(same1==1){
if(a[3]==7)
a[3]=1;
if(b[3]==7)
b[3]=1;
cnt1=a[1]+a[2]+a[3];
cnt2=b[1]+b[2]+b[3];
if(cnt1>cnt2)
printf("Alice\n");
else if(cnt1<cnt2)
printf("Bob\n");
else
printf("Draw\n");
}
else{
if(a[2]>b[2])
printf("Alice\n");
else if(a[2]<b[2])
printf("Bob\n");
else {
if(a[1]==b[1]){
if(a[3]>b[3])
printf("Alice\n");
else if(a[3]<b[3])
printf("Bob\n");
else
printf("Draw\n");
}
else {
if(a[1]>b[1])
printf("Alice\n");
else if(a[1]<b[1])
printf("Bob\n");
else
printf("Draw\n");
}
}
}
}
}
}