答案

鑫鑫  •  11个月前


include <stdio.h>

int main() {

int n, m, w = 0;
scanf("%d%d", &n, &m);
for (int x = 0; x <= n; x++) { //鸡
	for (int y = 0; y <= n; y++) {
		//兔
		if (x + y == n && x * 2 + y * 4 == m) {
			printf("%d %d", x, y);
			w++;
		}
	}
}
if (w == 0) {
	printf("NULL");
}

return 0;

}


评论:

请先登录,才能进行评论