#include<iostream>
#include<vector>
using namespace std;
typedef struct ListNode {
int val;
struct ListNode* next;
}ListNode,*List;
void createList(List L, int n) {
ListNode* r = L;
for (int i = 0; i < n; i++) {
ListNode* p=new ListNode;
cin >> p->val;
p->next = NULL;
r->next = p;
r = r->next;
}
}
bool isPalindrome(List L) {
vector<int> nums;
while (L) {
nums.push_back(L->val);
L = L->next;
}
vector<int>temp = nums;
reverse(temp.begin(), temp.end());
for (int i = 0; i < nums.size(); i++) {
if (nums[i] != temp[i])
return false;
}
return true;
}
int main() {
bool flag;
List L = new ListNode;
L->next = NULL;
int n;
cout << "请输入链表长度:";
cin >> n;
createList(L, n);
flag=isPalindrome(L->next);
cout << boolalpha<<flag;
return 0;
}