- 面数相同
1 | 2 | 3 | 4 | 5 | 6 | |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
两个面的数字和概率最大为数字 :6+1 = 7
即7共出现了6次
- 面数不同
1 | 2 | 3 | 4 | 5 | |
---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 |
2 | 3 | 4 | 5 | 6 | 7 |
3 | 4 | 5 | 6 | 7 | 8 |
4 | 5 | 6 | 7 | 8 | 9 |
5 | 6 | 7 | 8 | 9 | 10 |
6 | 7 | 8 | 9 | 10 | 11 |
7 | 8 | 9 | 10 | 11 | 12 |
8 | 9 | 10 | 11 | 12 | 13 |
两个面的数字和概率最大为数字 :5+1 = 6 到 8+1=9
即6, 7, 8, 9都出现了5次
参考链接:传送门
#define LOCAL
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define inf 0x3f3f3f3f
#define eps 1e-6
using namespace std;
#define clr(x) memset(x,0,sizeof((x)))
const int maxn = 1e5+1;
#define MAX(a,b,c) ((a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c)))
#define _max(a,b) ((a) > (b) ? (a) : (b))
#define _min(a,b) ((a) < (b) ? (a) : (b))
int cmp(int x,int y) {
return x<y;
}
int main() {
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif
int buf[3];
for(int i = 0;i<3;i++) {
cin>>buf[i];
}
sort(buf,buf+3,cmp);
int len = buf[2]+1-(buf[0]+1)+1;
if(buf[1]<=len)cout<<buf[0]+1+buf[1];
else cout<<buf[2]+1+1+(buf[1]-len)/2;
return 0;
}