您的位置:首页 > 其它

Codeforces Round #190 (Div. 2) B. Ciel and Flowers

2013-07-03 14:14 295 查看
链接:http://codeforces.com/contest/322/problem/B

这题做错了。没考虑周全。

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
int r, g, b;
while (~scanf("%d%d%d", &r, &g, &b)) {
int x = r % 3, y = g % 3, z = b % 3, Max = max(x, max(y, z)), cnt =r/3+g/3+b/3;
if (Max == 1) {
if (x == y && y == z && x == 1) cnt++;
}
if (Max == 2) {
if (x + y + z == 4) {
if (x*y*z) cnt++;
else if (!x && r/3) cnt++;
else if (!y && g/3) cnt++;
else if (!z && b/3) cnt++;
}
else if (x + y + z == 5) cnt++;
else if (x + y + z == 6) cnt+=2;
}
printf("%d\n", cnt);
}

return 0;
}


。。

。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: