0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

3元1次不定方程式〈2/2〉「2018東工大数学第2問」pythonでやってみた。

Last updated at Posted at 2022-04-14

つづき

(1)35*x + 91*y + 65*z = 3 整数
(2)x**2+y**2の最小値

誰かpythonでやってもらうと助かります。

pythonの合同式でやってみたい。

(勉強中)

pythonのpulpソルバーでやってみたい。

(勉強中)

pythonのループで

nMaxがあやしいですね。

nMax=10
r = range(-nMax, nMax, 1)
myMin=nMax**2+nMax**2
for i in r:
    for j in r:
        for k in r:
            if 35*i + 91*j + 65*k == 3:
                i2j2=i**2 +j**2
                if i2j2 < myMin:
                    myI=i
                    myJ=j
                    myK=k
                    myMin=i2j2
                    print("#", i, j, k,myMin)
                else:
                   print("#",i,j,k)
print("#(2)最小値",myI,myJ,myK,myMin)
# -4 -2 5 20
# -4 3 -2
# -4 8 -9
# 9 -7 5
# 9 -2 -2
# 9 3 -9
#(2)最小値 -4 -2 5 20
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?