Codeforces1221 C. Perfect Team_比赛


Codeforces1221 C. Perfect Team_比赛_02

题意:

Codeforces1221 C. Perfect Team_比赛_03 种人各 Codeforces1221 C. Perfect Team_比赛_04 个, 要求 Codeforces1221 C. Perfect Team_比赛_03 人一队, 每队必须至少有 Codeforces1221 C. Perfect Team_比赛_06 各一种, 问最多能组成多少队。
因为c, m至少有1, 所以考虑最小,。剩下的模拟即可。

AC代码:

const int N = 110;
int n, m, t;
int c, x;

int main()
{
sd(t);
while (t--)
{
int ans = 0;
sddd(c, m, x);
int minn = min(c, m);
if (minn <= x)
{
ans = minn;
}
else
{
c -= x;
m -= x;
ans += x;
if (c > m)
swap(c, m);
if (m >= 2 * c)
ans += c;
else
{
ll res=c+m;
ans+=(res/3);
}
}
pd(ans);
}
return 0;
}