forked from keshavnandan/Topcoder
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddMultiply.cpp
More file actions
Latest commit
33 lines (26 loc) · 794 Bytes
/
Copy pathAddMultiply.cpp
File metadata and controls
33 lines (26 loc) · 794 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
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
usingnamespacestd;
classAddMultiply {
public:
vector <int> makeExpression(int y)
{
vector<int> v(3);
for(int i = -1000; i <= 1000; i++)
for(int j = -1000; j <= 1000; j++)
for(int k = -1000; k <= 100; k++){
if(i && j&& k && (i != 1) && (j != 1) && (k != 1)){
if((i*j + k) == y){
v[0] = i;
v[1] = j;
v[2] = k;
return v;
}
}
}
}
};