求助,样例都过不了
查看原帖
求助,样例都过不了
1104356
moorrunner楼主2023/11/12 16:57
#include <stdio.h>
#include <math.h>

typedef struct {
    char name[9];
    int yw;
    int sx;
    int yu;
    int zf;
} cji;

int main(void) {
    int n, i, j;
    scanf("%d", &n);
    cji txue[1001];
    for (i = 0; i < n; i++) {
        scanf("%s %d %d %d", txue[i].name, &txue[i].yw, &txue[i].sx, &txue[i].yu);
        txue[i].zf = txue[i].sx + txue[i].yu + txue[i].yw;
    }
    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            if (abs(txue[i].yu - txue[j].yu) < 5 &&
                abs(txue[i].sx - txue[j].sx) < 5 &&
                abs(txue[i].yw - txue[j].yw) < 5 &&
                abs(txue[i].zf - txue[j].zf) < 10) {
                printf("%s %s\n", txue[i].name, txue[j].name);
            }
        }
    }
    return 0;
}
2023/11/12 16:57
加载中...