Result: 21 points Time: 60 minutes
Re-challenge: 100 After all, it turned out that thinking ability declines when time is chased.
After all, the most important thing to pay attention to in such a problem was the ** boundary of conditions **. I was able to succeed if I cleared the boundary of the condition Write the death code as a hint.
```python
#In your favorite language
x_time,y_time,z_time = input().split() #print(x_time, y_time, z_time)
day = int(input()) #print(day)
import sys line = sys.stdin.readlines()
result = [] #ghsfrh
""" for i in range(day): start, end = line[i].split()
dayss = []
days = int(end)-int(start)
#print(days)
for i in range(int(start), int(end)):
dayss.append(i)
print(len(dayss))
print(dayss)
for j in range(len(dayss)):
if 0 <= j and 8 >= j:
result.append(int(z_time))
elif 9 <= j and 17 >= j:
result.append(int(x_time))
elif 17 <= j and 22 >= j:
result.append(int(y_time))
else:
print("Off hours")
print(sum(result))
"""
for i in range(day): start, end = line[i].split() if int(start) >= 0 and int(end) <= 9: z_tiem_result = (int(end)-int(start)) * int(z_time) result.append(z_tiem_result) #print(z_tiem_result) elif int(start) >= 9 and int(end) <= 17: x_time_result = (int(end)-int(start)) * int(x_time) result.append(x_time_result) #print(x_time_result, result)
elif int(start) >= 17 and int(end) <= 22:
y_time_result = (int(end)-int(start)) * int(y_time)
result.append(y_time_result)
#print(y_time_result, result)
elif int(start) >= 22:
z_tiem_result = (int(end)-int(start)) * int(z_time)
result.append(z_tiem_result)
#print(z_tiem_result, result)
else:
#print("Off hours")
pass
#print(result)
print(sum(result))
```
Recommended Posts