错误的
#include <stdio.h>
int main() {
int n, a, b, i, m;;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
m = 0;
scanf("%d%d", &a, &b);
if (a > 0 && b > 0) {
if (b / a <=3 || a / b <= 3 ) {
m = (a + b) / 4;
}
if (a / b >3 || b / a >3 ) {
if (a > b)
m = b;
else
m = a;
}
}
printf("%d\n", m);
}
}
正确的
#include <stdio.h>
int main() {
int n, a, b, i, m;;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
m = 0;
scanf("%d%d", &a, &b);
if (a > 0 && b > 0) {
if (b / a <3 || a / b < 3 ) {
m = (a + b) / 4;
}
if (a / b >= 3 || b / a >= 3 ) {
if (a > b)
m = b;
else
m = a;
}
}
printf("%d\n", m);
}
}