Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4a3d1e8

Browse files
Update
1 parent 70ced89 commit 4a3d1e8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

‎algorithms/22_drawing-book.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
#
10+
# Complete the 'pageCount' function below.
11+
#
12+
# The function is expected to return an INTEGER.
13+
# The function accepts following parameters:
14+
# 1. INTEGER n
15+
# 2. INTEGER p
16+
#
17+
18+
def pageCount(n, p):
19+
# Write your code here
20+
if p<=n:
21+
return min(p//2, n//2 - p//2)
22+
23+
if __name__ == '__main__':
24+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
25+
26+
n = int(input().strip())
27+
28+
p = int(input().strip())
29+
30+
result = pageCount(n, p)
31+
32+
fptr.write(str(result) + '\n')
33+
34+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /