我看到大多數人只是循環添加數字和他們的正方形。我嘗試了不同的方法。使用小數學,我知道,我意識到我有這是一個非常有效的解決方案:公式「N數字的平方和」 public static long sumOfNSquares(int N){
// This is the standard mathematical formula I learnt in grade 10
return (
(使用dajngo 1.9和Python 2.7版) 所以我有幾個子類的抽象類。它看起來像這樣: class Node(models.Model):
[...]
class Meta:
abstract = True
class Individual(Node):
[...]
class Company(Node):
[...]