diff options
Diffstat (limited to 'progs/a599.py')
-rw-r--r-- | progs/a599.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/progs/a599.py b/progs/a599.py new file mode 100644 index 0000000..789a533 --- /dev/null +++ b/progs/a599.py @@ -0,0 +1,9 @@ +def No_of_Triangle(N,K):
+ if (N < K):
+ return -1;
+ else:
+ Tri_up = 0;
+ Tri_up = ((N - K + 1) *(N - K + 2)) // 2;
+ Tri_down = 0;
+ Tri_down = ((N - 2 * K + 1) *(N - 2 * K + 2)) // 2;
+ return Tri_up + Tri_down;
\ No newline at end of file |