27.零起点学算法16——鸡兔同笼

#include<stdio.h>
int main(){
    int n,m;
    while(scanf("%d%d",&n,&m)!=EOF){
        if((m>=2*n)&&(m<=4*n)&&(m%2==0))
        printf("%d %d\n",2*n-m/2,m/2-n);
        else
        printf("No\n");
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/Estwind/p/9750179.html