#include <stdio.h> typedef struct same{ a,b; }same; int main(){ int T,n,m; scanf("%d",&T); same num[1000000]; while(T--){ int i,c,j; scanf("%d",&n); for(i=0; i < n; i++) scanf("%d=%d",&num[i].a,&num[i].b); scanf("%d", &m); for(i=0; i<m; i++){ scanf("%d",&c); for(j=0;j<n;j++){ if(c==num[j].a){ printf("%d\n",&num[j].b); break; } if(c==num[j].b){ printf("%d\n",&num[j].a); break; } } if(j==n) printf("UNKNOW\n"); } printf("\n"); } return 0; } /* Main.c:3:3: error: expected specifier-qualifier-list before 'a' a,b; ^ Main.c: In function 'main': Main.c:13:28: error: 'same' has no member named 'a' scanf("%d=%d",&num[i].a,&num[i].b); ^ Main.c:13:38: error: 'same' has no member named 'b' scanf("%d=%d",&num[i].a,&num[i].b); ^ Main.c:18:21: error: 'same' has no member named 'a' if(c==num[j].a){ ^ Main.c:19:32: error: 'same' has no member named 'b' printf("%d\n",&num[j].b); ^ Main.c:22:21: error: 'same' has no member named 'b' if(c==num[j].b){ ^ Main.c:23:32: error: 'same' has no member named 'a' printf("%d\n",&num[j].a); ^ Main.c:8:8: warning: variable 'num' set but not used [-Wunused-but-set-variable] same num[1000000]; ^ */ |
Double click to view unformatted code.