xdu1152_bad.cc 975 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. char name[1000001][30];
  4. char course[1000001][30];
  5. int main()
  6. {
  7. int n, m;
  8. while (scanf("%d%d",&n,&m)==2) {
  9. for (int i = 0; i<=1000000; i++) {
  10. name[i][0] = 0;
  11. course[i][0] = 0;
  12. }
  13. scanf("%*s%*s");
  14. for (int i = 0; i<n; i++) {
  15. char buf[30];
  16. int x;
  17. scanf("%s%d", buf, &x);
  18. strcpy(name[x], buf);
  19. }
  20. scanf("%*s%*s%*s");
  21. for (int i = 0; i<m; i++) {
  22. char buf[30];
  23. int x;
  24. scanf("%*s%d%s", &x, buf);
  25. strcpy(course[x], buf);
  26. }
  27. puts("Name StuNum CourseName");
  28. for (int i = 0; i<1000000; i++)
  29. if (name[i][0]) {
  30. printf("%s %d ", name[i], i);
  31. if (course[i][0])
  32. puts(course[i]);
  33. else
  34. puts("NULL");
  35. }
  36. }
  37. return 0;
  38. }