川のブログ

川の適当気ままなブログです。 

AOJ 0083 Era Name Transformation

こんにちは川です。

この問題は凡ミスしなければいけます。

ifぶんおおいな~

 

ソースコード

 

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int year,month,date;
    while(cin>>year>>month>>date){
        if(year<1868||year==1868&&month<9||year==1868&&month==9&&date<8)
cout<<"pre-meiji"<<endl;
        else if(year<1912||year==1912&&month<7||year==1912&&month==7&&date<30)
cout<<"meiji "<<year-1867<<" "<<month<<" "<<date<<endl;
        else if(year<1926||year==1926&&month<12||year==1926&&month==12&&date<25)
cout<<"taisho "<<year-1911<<" "<<month<<" "<<date<<endl;
        else if(year<1989||year==1989&&month==1&&date<8)
cout<<"showa "<<year-1925<<" "<<month<<" "<<date<<endl;
        else cout<<"heisei "<<year-1988<<" "<<month<<" "<<date<<endl;
    }
}