Created
November 13, 2019 10:13
-
-
Save yue4u/6228e0c3d1e3cb2a4518524d70e97e20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
問9. | |
とある店舗は一日あたりの経費として、 | |
家賃や商品原価および光熱費に50万円、 | |
平日の人件費が30万円で週末は手当で35%上乗せされるものとする。 | |
また、売上は休日明けの一日あたりのものが100万円で、 | |
それ以降は連勤するごとに3%ずつ効率が下がっていくものとする | |
前月の最終週が月曜から稼働が始まり、 | |
今月11月が金曜日からはじまって末日が30日、 | |
第2・第3土曜日に休日出勤が発生するものとした場合、 | |
予想される売上と利益は何円か出力するプログラムを実装せよ | |
│ Calendar │ | |
├────────────────────────────────┤ | |
│ November 2019 │ | |
│ Mon Tue Wed Thu Fri Sat Sun │ | |
│ 28 29 30 31 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 27 28 29 30 1 │ | |
""" | |
DAY_BASIC_COST = 50 | |
DAY_HUMAN_COST = 30 | |
DAY_HUMAN_COST_WEEKEND = 30 * 1.35 | |
DAY_INCOME = 100 | |
DAY_INCOME_COEFFICIENCE = 1 - 0.03 | |
total_cost = 0 | |
total_income = 0 | |
def open_shop(days: int, start: int = 0): | |
if (start + days) > 7: | |
raise Exception("start + days should <= 7") | |
for i in range(days): | |
day = start + i + 1 | |
# 家賃や商品原価および光熱費 | |
cost = DAY_BASIC_COST | |
# 人件費 | |
if (day <= 5): | |
cost += DAY_HUMAN_COST | |
else: | |
cost += DAY_HUMAN_COST_WEEKEND | |
# 売上 | |
income = DAY_INCOME * (DAY_INCOME_COEFFICIENCE ** (start + i)) | |
global total_cost, total_income | |
total_income += income | |
total_cost += cost | |
print(day, int(income), cost, sep="\t") | |
print("") | |
print("day", "income", "cost", sep="\t") | |
open_shop(days=1, start=4) | |
open_shop(days=6) | |
open_shop(days=6) | |
open_shop(days=5) | |
print(f""" | |
売上 = {total_cost} | |
コスト = {total_income} | |
利益 = {total_income - total_cost} | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment