#40401: c++ answer


1121226@stu.wghs.tp.edu.tw (Arthur1121226)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.139]
最後登入時間 :
2024-11-04 13:24:52
k863. 清朝年號轉換 -- 板橋高中教學題 | From: [60.248.154.139] | 發表日期 : 2024-05-17 12:58

#include <iostream>
#include <string>
using namespace std;
int main() {
  string a;
  int b;
  cin >> a >> b;
  if (a == "ShunZhi"){
    cout << 1643 + b;
  }
  else if (a == "KangXi"){
    cout << 1661 + b;
  }
  else if (a == "YongZheng"){
    cout << 1722 + b;
  }
  else if (a == "QianLong"){
    cout << 1735 + b;
  }
  else if (a == "JiaQing"){
    cout << 1795 + b;
  }
  else if (a == "DaoGuang"){
    cout << 1820 + b;
  }
  else if (a == "XianFeng"){
    cout << 1850 + b;
  }
  else if (a == "TongZhi"){
    cout << 1861 + b;
  }
  else if (a == "GuangXu"){
    cout << 1874 + b;
  }
  else if (a == "XuanTong"){
    cout << 1908 + b;
  }
  return 0;
}

 
ZeroJudge Forum