forked from kavisha-nethmini/hacktoberfest-contribute
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptional_Server.cpp
More file actions
48 lines (43 loc) · 840 Bytes
/
Copy pathExceptional_Server.cpp
File metadata and controls
48 lines (43 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <exception>
#include <string>
#include <stdexcept>
#include <vector>
#include <cmath>
using namespace std;
class Server {
private:
… 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;
try
{
cout << Server::compute(A, B) << endl;
}
catch (std::bad_alloc& error)
{
cout << "Not enough memory" << endl;
}
catch (std::exception& error)
{
cout << "Exception: " << error.what() << endl;
}
catch (...)
{
cout << "Other Exception" << endl;
}
}
cout << Server::getLoad() << endl;
return 0;
}