My issue
hey anyone can help me, i was trying to solve this problem and get the exact output and input, but my code just failed to submit
My code
#include <iostream>
using namespace std;
int maxDice(int array[3]){
int max = 2, min = 0, x, d;
int n = 3;
d = n/2*(2+n-1);
for (int i = 0; i<d; i++){
if (array[max] > array[min]){
x = array[min];
array[min] = array[max];
array[max] = x;
min++;
} else if (array[min] > array[max]){
max--;
min = 0;
}
}
return (array[0]*10+array[1])*10+array[2];
}
int main() {
int T;
cin >> T;
for (int i = 0; i < T; i++){
int a[3], b[3], d, e;
for (int u=0;u<3;u++){
cin >> a[u];
}
for (int u=0;u<3;u++){
cin >> b[u];
}
d = maxDice(a);
e = maxDice(b);
if(d > e){
cout << "Alice" << endl;
} else if (d < e){
cout << "Bob" << endl;
} else {
cout << "Tie" << endl;
}
}
return 0;
}
Problem Link: DICENUM Problem - CodeChef