ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1001. Reverse Root

1001. Reverse Root
Posted by Suraj Sharma 20 Jun 2019 11:03
The following code is failing the test case 3, I have used linked-list to store the data in as a stack. Below is the code for reference, can you tell me where I am going wrong. Thank you.

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<math.h>
#include<assert.h>

typedef unsigned long long _ull;
typedef unsigned int _uint;

_ull _number;
} _list;

void _makenode(_list**,_ull);
void _insertnode(_list**,_list*);

int main(int argc,const char*argv[]) {
_ull _val;
while(true) {
fscanf(stdin,"%lld",&_val);
assert(_val>=0);
if(feof(stdin)) break;
}
free(_temp);
}
return 0;
}

void _makenode(_list**_ptr,_ull _data) {
_list*_node = malloc(sizeof(_list));
(_node->_number) = _data;
(_node->_next) = NULL;
_insertnode(_ptr,_node);
}

void _insertnode(_list**_ptr,_list*_node) {
if(!(*_ptr)) (*_ptr) = _node;
else {
(_node->_next) = (*_ptr);
(*_ptr) = _node;
}
}