Last active
December 12, 2018 13:19
-
-
Save junhoyeo/5853312690892032bbf4fe2704b375cd to your computer and use it in GitHub Desktop.
세 실수 x, y, z가 다음 조건을 만족시킨다. 1) x, y, 2z 중에서 적어도 하나는 3이다. 2) 3(x+y+2z)=xy+2yz+2zx 이때 10xyz의 값을 구하시오
This file contains hidden or 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
| import numpy as np | |
| def check(x, y, z, log=False): | |
| s1 = True if any(i==3 for i in [x, y, z*2]) else False | |
| s2 = 3*(x+y+2*z)==x*y+2*y*z+2*z*x | |
| if log: print(3*(x+y+2*z), '==', x*y+2*y*z+2*z*x) | |
| return s1 and s2 | |
| for i in np.arange(0, 100, 0.5): | |
| for j in np.arange(0, 100, 0.5): | |
| for k in np.arange(0, 100, 0.5): | |
| if check(i, j, k): | |
| print('x=',i,'y=',j,'z=',k) | |
| # print(check(i, j, k, log=True)) | |
| print('ans:', 10*i*j*k) |
Author
Author
실행결과
x= 0.5 y= 3.0 z= 9.0
ans: 135.0
x= 0.5 y= 18.0 z= 1.5
ans: 135.0
x= 1.0 y= 3.0 z= 4.5
ans: 135.0
x= 1.0 y= 9.0 z= 1.5
ans: 135.0
(...)
^C
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
다음 문제의 답을 브루트포싱으로 구합니다.