Created
February 7, 2019 03:38
-
-
Save newjam/d4b35c013c56f44400d573afb3ae3819 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; https://leetcode.com/problems/3sum-closest/ | |
(declare-const a Int) | |
(declare-const b Int) | |
(declare-const c Int) | |
(assert (or (= a -1) (= a 2) (= a 1) (= a -4))) | |
(assert (or (= b -1) (= b 2) (= b 1) (= b -4))) | |
(assert (or (= c -1) (= c 2) (= c 1) (= c -4))) | |
(assert (< a b)) | |
(assert (< b c)) | |
(declare-const target Int) | |
(assert (= target 1)) | |
(declare-const total Int) | |
(assert (= total (+ a b c))) | |
(minimize (abs (- target total))) | |
(check-sat) | |
(get-model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment