HDU 1721

http://acm.hdu.edu.cn/showproblem.php?pid=1721

非常有趣的一道水题,注意到相隔一个点的粒子数是可以相互转移的,所以只要判红点的和与蓝点的和是否相等

#include <cstdio>

int main(){
    int A,B,C,D,E,F,G,H;
    while(~scanf("%d",&A)){
        if(A==-1)break;
        scanf("%d%d%d%d%d%d%d",&B,&C,&D,&E,&F,&G,&H);
        if(A+C+F+H==B+D+E+G)puts("All the seeds can be cleared away!");
        else puts("Sorry,it can't be cleared away!");
    }
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/xiaohongmao/p/4116637.html