We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Classes
- Exceptional Server
- Discussions
Exceptional Server
Exceptional Server
Sort by
recency
|
169 Discussions
|
Please Login in order to post a comment
try { int res = Server::compute(A, B); if((A % B) == A) out_of_range("Accessing out of range"); } catch(bad_alloc& e) { cout << "Not enough memory " << endl; } catch(exception& e) { cout << "Exception: " << e.what() << endl; } catch(...) { cout << "Other Exceptions " << endl; }
sxalxmalxmlxm
x s x
include
include
include
include
include
include
using namespace std;
class Server { private: static int load; public: static int compute(long long A, long long B) { load += 1; if(A < 0) { throw std::invalid_argument("A is negative"); } vector v(A, 0); int real = -1, cmplx = sqrt(-1); if(B == 0) throw 0; real = (A/B)*real; int ans = v.at(B); return real + A - B*ans; } static int getLoad() { return load; } }; int Server::load = 0;
int main() { int T; cin >> T; while(T--) { long long A, B; cin >> A >> B;
}
code
include
include
include
include
include
include
using namespace std;
class Server { private: static int load; public: static int compute(long long A, long long B) { load += 1; if(A < 0) { throw std::invalid_argument("A is negative"); } vector v(A, 0); int real = -1, cmplx = sqrt(-1); if(B == 0) throw 0; real = (A/B)*real; int ans = v.at(B); return real + A - B*ans; } static int getLoad() { return load; } }; int Server::load = 0;
int main() { int T; cin >> T; while(T--) { long long A, B; cin >> A >> B;
}
include
include
include
include
include
include
using namespace std;
class Server { private: static int load; public: static int compute(long long A, long long B) { load += 1; if(A < 0) { throw std::invalid_argument("A is negative"); } vector v(A, 0); int real = -1, cmplx = sqrt(-1); if(B == 0) throw 0; real = (A/B)*real; int ans = v.at(B); return real + A - B*ans; } static int getLoad() { return load; } }; int Server::load = 0;
int main() { int T; cin >> T; while(T--) { long long A, B; cin >> A >> B;
}
it isn't clear what it wants for the return value of the two numbers if there isn't an error state. From the example input
25581 3661
should return25575