#44376: python 淺顯易懂(gtp)


suyueh (suyueh)

學校 : 不指定學校
編號 : 272111
來源 : [101.10.93.239]
最後登入時間 :
2024-12-10 22:48:32
k863. 清朝年號轉換 -- 板橋高中教學題 | From: [101.10.92.238] | 發表日期 : 2024-11-30 23:16

# 建立一個年號對應的起始西元年份字典
year_map = {
    "ShunZhi": 1644,
    "KangXi": 1662,
    "YongZheng": 1723,
    "QianLong": 1736,
    "JiaQing": 1796,
    "DaoGuang": 1821,
    "XianFeng": 1851,
    "TongZhi": 1862,
    "GuangXu": 1875,
    "XuanTong": 1909
}

# 讀取輸入
era, year = input().split()
year = int(year)

# 根據年號和年份計算西元年份
start_year = year_map[era]
western_year = start_year + (year - 1)

# 輸出結果
print(western_year)

# 建立一個年號對應的起始西元年份字典
year_map = {
    "ShunZhi": 1644,
    "KangXi": 1662,
    "YongZheng": 1723,
    "QianLong": 1736,
    "JiaQing": 1796,
    "DaoGuang": 1821,
    "XianFeng": 1851,
    "TongZhi": 1862,
    "GuangXu": 1875,
    "XuanTong": 1909
}

# 讀取輸入
era, year = input().split()
year = int(year)

# 根據年號和年份計算西元年份
start_year = year_map[era]
western_year = start_year + (year - 1)

# 輸出結果
print(western_year)

 
ZeroJudge Forum