P2911 [USACO08OCT]Bovine Bones G
#include<iostream>
using namespace std;
int main()
{
int s1, s2, s3, num[100] = {0}, maxn = 0, ans;
cin >> s1 >> s2 >> s3;
for(int i = 1; i <= s1; i++)
for(int j = 1; j <= s2; j++)
for(int k = 1; k <= s3; k++)
num[i + j + k]++;
for(int i = 0; i <= s1 + s2 + s3; i++)
if(num[i] > maxn)
{
maxn = num[i];
ans = i;
}
cout << ans << endl;
return 0;
}