#include <stdio.h> #include <stdlib.h> typedef struct Node { int num; struct Node *next; }LinkNode; LinkNode *creat_link(int n){ int i; LinkNode *head = (LinkNode *)malloc(sizeof(LinkNode)); LinkNode *tail; head->next = NULL; scanf("%d", &head->num); tail = head; for (i = 0; i < n-1; ++i) { LinkNode *p = (LinkNode *)malloc(sizeof(LinkNode)); scanf("%d", &p->num); p->next = NULL; tail->next = p; tail = tail->next; } return head; } void add_node(int n, const LinkNode *head_1, LinkNode *head_2){ int i; LinkNode *tail_1 = head_1; LinkNode *tail_2 = head_2; for(i = 0; i < n; ++i){ tail_2->num = tail_2->num + tail_1->num; tail_1 = tail_1->next; tail_2 = tail_2->next; } } int main(int argc, char const *argv[]) { int n,i; scanf("%d", &n); LinkNode *head_1 = creat_link(n); LinkNode *tail; LinkNode *head_2 = creat_link(n); add_node(n, head_1, head_2); tail = head_2; while(tail != NULL){ printf("%d ", tail->num); tail = tail->next; } printf("\n"); return 0; }