|
|
back to boardMemory limit exceeded Posted by Enoch 19 Aug 2014 00:09 #include <stack> #include <cmath> #include <iostream> int main() { unsigned long long int n; std::stack<unsigned long int> numbers; while (!std::cin.eof()) numbers.push(n); while (!numbers.empty()) { std::cout << sqrt( double( numbers.top() ) ) << " "; numbers.pop(); } return 0; } Probably the stack this code builds is too large, but I can't see how to optimise it, given the sample numbers. Re: Memory limit exceeded Posted by ER 22 Aug 2014 13:53 I don't think your first while loop ever terminates. |
|
|