1.初步了解干支纪年
2.思维
代码实现
#include <iostream>
using namespace std;
int n;
string t[15]={"jia","yi","bing","ding","wu","ji","geng","xin","ren","gui"};
string d[15]={"zi","chou","yin","mao","chen","si","wu","wei","shen","you","xu","hai"};
int main()
{
cin>>n;
int a,b;
if(n>3)
{
n-=3;
a=n%10, b=n%12;
if(a==0) a=10;
if(b==0) b=12;
}
else
{
n=n-3;
a=n+10, b=n+12;
}
cout<<t[a-1]<<d[b-1]<<'\n';
return 0;
}