|
|
вернуться в форумMemory limit exceeded Послано Enoch 19 авг 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 Послано ER 22 авг 2014 13:53 I don't think your first while loop ever terminates. |
|
|