mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Dang
This commit is contained in:
4
scripts/test_sum/results.md
Normal file
4
scripts/test_sum/results.md
Normal file
@@ -0,0 +1,4 @@
|
||||
C 0.002s 1
|
||||
JS 0.064s 32
|
||||
Py3 0.070s 35
|
||||
Toy 0.430s 215
|
||||
16
scripts/test_sum/test_sum.py
Normal file
16
scripts/test_sum/test_sum.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys
|
||||
sys.setrecursionlimit(11000)
|
||||
|
||||
#the test case (python)
|
||||
def test_sum(key: int, val: int):
|
||||
def sum(n: int):
|
||||
if n < 2:
|
||||
return n
|
||||
|
||||
return n + sum(n - 1)
|
||||
|
||||
result: int = sum(val)
|
||||
print(str(key) + ": " + str(result))
|
||||
|
||||
for i in range(0, 10):
|
||||
test_sum(i, i * 1000)
|
||||
Reference in New Issue
Block a user