close
Problem Description
國父孫中山於 1911 年武昌起義推翻滿清創立中華民國,並訂次年 (1912) 年為中華民國元年。從此國民政府便以中華民國國號記年至今。請寫一程式,將輸入的西元年份轉換成民國年份後輸出。
Input Format
輸入僅有一行,其中包含一個西元年份 y (1912 ≤ y ≤ 2147483647)。
Output Format
輸出所算出的民國年份。
Sample Input
2008
Sample Output
97
-----*Problem from【ZeroJudge, An Online Judge System For Beginners】
My Answer
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. |
#include<iostream> using namespace std; int main(void) { int y; while(cin>>y){ cout<<y-1911<<endl; } return 0; } |
全站熱搜