Notice
Recent Posts
Recent Comments
Link
목록연산자 끼워넣기 (2) (1)
Be a developer
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ZYt4U/btqt8mUiAfB/cltB2ViDo8tbJC5L30T7bk/img.png)
연산자 끼워넣기 문제와 똑같다. 다른 점이 있다면 모든 숫자를 다 사용했을 때 함수를 return 시킨다는 것. 각 숫자 사이에 4개의 연산자가 다 들어갈 가능성이 있으므로, 4^(N-1)의 시간복잡도를 갖는다. N이 최대 11이므로 브루트포스로 풀 수 있는 문제이다. 1234567891011121314151617181920212223242526272829303132333435363738#include #include #include using namespace std; vector ans;int n; void solve(int idx, int sum, int plus, int minus, int mult, int div, vector num) { //모든 숫자를 연산에 다 사용하면 return한다. i..
알고리즘
2019. 4. 4. 02:29