所以我正在寫一個比賽的遊戲。 直到此時,用戶輸入了一個數字。 if user % 2 == 0 :
print("What you entered is an even number.")
print("")
print("So, according to RULE 1, we must now divide it by 2.")
int(user)/
所以我在java中製作了一個cookie喀嗒聲器克隆(對我來說是羞恥),並且首先,我需要使用double來增加.1。的代碼看起來是這樣的(餅乾是雙,和所有其他值是整數): cookies = cookies + (cursors*.1+grandmas/2+farms*4+factories*10);
然而,當該輸出時,它輸出像2.399999999999999代替2.4的數字。到底是怎麼回事
其實我需要計算: S_i = sum(U_j * U_j.transpose) * K_i
其中 U_j is a n * k dim matrix,
K_i is a n * n dim matrix,
j != i,
i = 1, 2, ..., n
而且我用這樣的循環: import numpy as np
for i in xrange(n):
temp = np