-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram 04
More file actions
26 lines (21 loc) · 783 Bytes
/
Copy pathProgram 04
File metadata and controls
26 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def max_problems_solved(N, P):
# Total available time for solving problems (240 minutes minus travel time)
remaining_time = 240 - P
# Initialize counters for time and problems solved
time_spent = 0
count = 0
# Iterate over problems from 1 to N
for i in range(1, N + 1):
# Time to solve the ith problem
time_to_solve = 5 * i
# Check if there's enough time left to solve this problem
if time_spent + time_to_solve > remaining_time:
break # Max can't solve more problems
# Update the time spent and count of problems solved
time_spent += time_to_solve
count += 1
return count
N=int(input())
P=int(input())
result=max_problems_solved(N,P)
print(result)