思路:
分情况讨论:
当 m i n ( R , Y , B ) > 1 min(R ,Y ,B)>1 min(R,Y,B)>1,一种结果,然后考虑, ( R , Y , B ) (R,Y,B) (R,Y,B)只有一个为 1 1 1, ( R , Y , B ) (R,Y,B) (R,Y,B)只有两个为 1 1 1, ( R , Y , B ) (R,Y,B) (R,Y,B)三个都为 1 1 1,然后考虑, ( R , Y , B ) (R,Y,B) (R,Y,B)只有一个为 0 0 0的情况,两个为 0 0 0的情况,全都为 0 0 0的情况。
恶心的模拟:
参考代码:
/*
* @Author: vain
* @Date: 2020-08-26 11:58:46
* @LastEditTime: 2020-09-12 20:06:24
* @LastEditors: sueRimn
* @Description: In User Settings Edit
* @FilePath: \main\demo.cpp
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
#define ll long long
typedef unsigned long long ull;
const int N = 1e3 + 20;
const ll maxn = 5e5 + 20;
const ll mod = 998244353;
ll head[maxn], stac[maxn];
int a[maxn], b[maxn], c[maxn], vis[maxn];
// typedef pair p;
// priority_queue, greater
> m;
// ll sum[maxn];
int max(int a, int b) {
return a > b ? a : b; }
ll min(ll a, ll b) {
return a < b ? a : b; }
ll gcd(ll a, ll b) {
return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) {
return a * b / gcd(a, b); }
void swap(ll &x, ll &y) {
x ^= y, y ^= x, x ^= y; }
map<string, ll> pll, che, mp;
int ik[N], q[N], cnt;
int lowbit(int x) {
return (x) & (-x); }
vector<int> fc[maxn];
// ull h[maxn], p[maxn];
const ull base = 13331;
char s1[maxn];
ll ksm(ll a, ll b, ll mod)
{
ll res = 1;
while (b)
{
if (b & 1)
res = (a * res) % mod;
b >>= 1;
a = a * a % mod;
}
return res;
}
struct node
{
ll a, b, w;
} p[maxn];
bool cmp(node x, node y)
{
return x.w > y.w;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
srand(time(NULL));
ll t, n, m;
ll r, y, x, b;
while (cin >> r >> y >> b)
{
x = r + y + b;
if (min(b, min(r, y)) >= 2)
{
cout << 15 + max(0ll, x - 6) * 6 << endl;
}
else
{
ll a;
a = 0;
if (r && b && y)
{
if (r == 1)
a++;
if (y == 1)
a++;
if (b == 1)
a++;
if (a == 1)
{
ll sum = 10ll + max(0ll, x - 5) * 5ll;
cout << sum << endl;
}
if (a == 2)
{
ll sum = 6ll + max(0ll, x - 4) * 4;
cout << sum << endl;
}
if (a == 3)
{
cout << 3ll << endl;
}
}
else
{
if (r == 0)
a++;
if (y == 0)
a++;
if (b == 0)
a++;
if (a == 1)
{
ll k = x - 2;
if (k == 1)
cout << 3 << endl;
else if (k <= 0)
cout << 1 << endl;
else if (k <= 2||r==1||y==1||b==1)
{
cout << (3ll + (k - 1ll) * 3ll) << endl;
}
else
{
ll sum = 6ll + (k - 2ll) * 4ll;
cout << sum << endl;
}
}
if (a == 2)
{
ll sum = (1ll + max(0ll, x - 2ll) * 2ll);
if (x != 1ll)
cout << sum << endl;
else
{
cout << 0ll << endl;
}
}
if (a == 3ll)
{
cout << 0ll << endl;
}
}
}
}
}