ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Странно, но со struct работает и у меня; но не на сервере. У меня libc6.

#include <stdio.h>
#include <math.h>

struct Node // РЕШЕНИЕ: ЗДЕСЬ НУЖНО ПИСАТЬ class. Компилятор тимуса ругается почему-то.
{
    public:
    Node* prev;
    double info;
};

int main()
{
    Node* p = NULL;
    Node* node;
    double d;
    while(scanf("%lf",&d)!=EOF)
    {
        node = new Node;
        node->info = sqrt(d);
        node->prev = p;
        p = node;
    }

    while (p != NULL)
    {
        printf("%.4lf\n", p->info);
        p = p->prev;
    }
    return 0;
}

Edited by author 31.12.2009 03:44
Выводить надо в обратном порядке