diff --git a/argorithm/123add_dp_practice.py b/argorithm/123add_dp_practice.py new file mode 100644 index 0000000..001737d --- /dev/null +++ b/argorithm/123add_dp_practice.py @@ -0,0 +1,10 @@ +import sys + +T = int(sys.stdin.readline()) + +dq = [0, 1, 2, 4] +for _ in range(T): + n = int(sys.stdin.readline()) + for i in range(len(dq), n+1): + dq.append(dq[i-1]+dq[i-2]+dq[i-3]) + print(dq[n]) \ No newline at end of file