NOJ1004线性表操作 解题思路暴力,来多少放多少。 (下列代码已经通过测试) #include #include int main() { int che1, che2, che3; int* in = NULL; int dein = 0; char* cha = NULL; char decha = 0; double* dou = NULL; double dedou = 0; int n1, n2, n3; { scanf("%d\n", &n1); in = malloc(sizeof(int) * n1); for (che1 = 0; che1 < n1; che1++) scanf("%d", in + che1); scanf("%d", &dein); } { scanf("%d\n", &n2); cha = malloc(sizeof(char) * n2); for (che2 = 0; che2 < n2; che2++) scanf("%c ", cha + che2); scanf("%c", &decha); } { scanf("%d\n", &n3); dou = malloc(sizeof(double) * n3); for (che3 = 0; che3 < n3; che3++) scanf("%lf", dou + che3); scanf("%lf", &dedou); } //int { for (che1 = n1 - 1; che1 >= 0; che1--) printf("%d ", in[che1]); printf("\n"); for (che1 = n1 - 1; che1 >= 0; che1--) { if (in[che1] == dein) continue; printf("%d ", in[che1]); } printf("\n"); } //char { for (che2 = n2 - 1; che2 >= 0; che2--) printf("%c ", cha[che2]); printf("\n"); for (che2 = n2 - 1; che2 >= 0; che2--) { if (cha[che2] == decha) continue; printf("%c ", cha[che2]); } printf("\n"); } //double { for (che3 = n3 - 1; che3 >= 0; che3--) printf("%g ", dou[che3]); printf("\n"); for (che3 = n3 - 1; che3 >= 0; che3--) { if (dou[che3] - dedou < 1E-6) continue; printf("%g ", dou[che3]); } } return 0; }