四角い地雷地帯
数学の力を使って地雷原をぬける.
目標
地雷原を歩く
オ-ガ達は数学に弱い, だから使っているんだよ cubic equation 地雷の通路を決定.
三次元方程式によって x 座標を元に y 座標を決める .
{x,y} 方程式を使って座標を決めるためにコ-ドを貰っている.
君のすべき事は power 関数を使って指数乗を計算する事.
ヒント
地雷原を歩く
解答
a
def mult(number, times):
total = 0
while times > 0:
total += number
times -= 1
return total
def power(number, exponent):
total = 1
while exponent > 0:
total = number * total
exponent = exponent - 1
return total
tower = hero.findFriends()[0]
a = tower.a
b = tower.b
c = tower.c
d = tower.d
x = hero.pos.x
while True:
y = a * power(x, 3) + b * power(x, 2) + c * power(x, 1) + d * power(x, 0)
hero.moveXY(x, y)
x = x + 5
a
- 最終更新:2017-06-04 11:34:00