Help me O。o

P1009 [NOIP1998 普及组] 阶乘之和

yuguiyyds @ 2022-07-13 10:59:18


def JC(a):
      b = 1
      while(a>0):
      b*=a
      a-=1
return b

n = int(input())
sum = 0
for i in range(n):
      c = JC(i+1)
      sum += c
print(sum)
为啥我这个无法编译,在自己的电脑上都行。

by 良心WA题人 @ 2022-07-13 11:00:01


by subway_xintu @ 2022-07-13 11:09:27

头文件发一下


by subway_xintu @ 2022-07-13 11:11:55

def在c++11里面用不了


by Monomial @ 2022-07-13 11:14:37

@yuguiyyds

改成这个就过了

def JC(a):
    b = 1
    while(a>0):
        b*=a
        a-=1
    return b

n = int(input())
sum = 0
for i in range(n):
      c = JC(i+1)
      sum += c
print(sum)

by zzyxl_qaq @ 2022-07-13 11:14:49

@fuck12 这不是C艹,这是Python


by subway_xintu @ 2022-07-13 11:34:01

az


by yuguiyyds @ 2022-07-13 15:20:52

@_Shu 改啥?


by yuguiyyds @ 2022-07-13 15:21:45

@fuck12 O。o


|