Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What is going on with this article?
@sky11fur

コードテストで力を付ける④

チャレンジした問題 C76

結果:21点
時間:60分

再チャレンジ:100
やはり時間に追われると思考能力が低下することが分かった。

次回へ

やはりこのような問題で一番気を付けるのが条件の境界でした。
条件の境界をクリアすれば成功できました
ヒントとして没コードを記す。

没コード

没コード

```python

coding: utf-8

自分の得意な言語で

Let's チャレンジ!!

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("時間外")
    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("時間外")
    pass

print(result)

print(sum(result))

```

1
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
sky11fur

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
1
Help us understand the problem. What is going on with this article?