You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
723 B

#include <bits/stdc++.h>
using namespace std;
const int N = 20 + 20 + 40 + 10;
int b[N];
int MAX;
int res;
int main() {
//三个骰子 tóu zi
int x, y, z; //面数
cin >> x >> y >> z;
for (int i = 1; i <= x; i++)//1
for (int j = 1; j <= y; j++)//2
for (int k = 1; k <= z; k++)//3
b[i + j + k]++;
for (int i = 3; i <= x + y + z; i++)
if (b[i] > MAX) res = i, MAX = b[i];
/*
for (int i = 3; i <= x + y + z; i++)
b[i] = max(b[i], MAX);
for (int i = 3; i <= x + y + z; i++) {
if (b[i] == MAX) {
res = i;
break;
}
}*/
cout << res << endl;
return 0;
}