G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*###Begin banned keyword - each of the following line if appear in code will raise error. regex supported
  2. define
  3. include
  4. class
  5. struct
  6. new
  7. delete
  8. ###End banned keyword*/
  9.  
  10. #include <iostream>
  11. using namespace std;
  12.  
  13. struct Node{
  14.     int val;
  15.     Node* next;
  16. };
  17.  
  18. struct List{
  19.     Node *head, *tail;
  20. };
  21.  
  22. void list_initializing(List &l){
  23.     l.head = l.tail = NULL;
  24. }
  25. void add_tail(List &l, int x){
  26.     Node*p = new Node;
  27.     p->val = x;
  28.     p->next = NULL;
  29.  
  30.     if (l.head == NULL){
  31.         l.head = l.tail = p;
  32.     } else {
  33.         l.tail->next = p;
  34.         l.tail = p;
  35.     }
  36. }
  37.  
  38.  
  39. bool is_palindrome(List &l){
  40. //Code ở đây nhé;
  41. }
  42.  
  43. int main()
  44. {
  45.     cin.tie(NULL);
  46.     std::ios_base::sync_with_stdio(false);
  47.     List l; list_initializing(l);
  48.  
  49.     int x;
  50.     do{
  51.         cin >> x;
  52.         if (x != 0) add_tail(l, x);
  53.         else break;
  54.     } while(true);
  55.  
  56.     if (is_palindrome(l)) cout << "TRUE";
  57.     else cout << "FALSE";
  58.     cout << endl;
  59.  
  60.     return 0;
  61. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top