笔盖大失


私信TA

用户名:Singer500

访问量:3838

签 名:

我的笔盖呢?

等  级
排  名 1133
经  验 3177
参赛次数 2
文章发表 17
年  龄 21
在职情况 学生
学  校
专  业 软件工程

  自我简介:

解题思路:通过题意计算出第0年的纪年来作为初始值

注意事项:

参考代码:

#include<iostream>
using namespace std;
int main(){
	string tiangan[10]={"jia","yi","bing","ding","wu","ji","geng","xin","ren","gui"};
	string dizhi[12]={"zi","chou","yin","mao","chen","si","wu","wei","shen","you","xu","hai"};
	int n,tstar=6,dstar=8;
	cin>>n;
	n%=60;
	cout<<tiangan[(n%10+tstar)%10]<<dizhi[(n%12+dstar)%12];
	return 0;
}


 

0.0分

3 人评分

  评论区

牛逼
2024-03-21 16:49:33
#include<iostream>
using namespace std;
string tian[10] = {"geng","xin","ren","gui","jia","yi","bing","ding","wu","ji"};
string di[12] = {"zi","chou","yin","mao","chen","si","wu","wei","shen","you","xu","hai"} ;
int  main()
{
	int n;
	cin>>n;
	if(n>0)
	{
			//2020年是庚子年
	int d = n>2020?(n-2020):(2020-n); 
	int a = d%10;
	int b = d%12;
	cout<<tian[a]<<di[b];
	}

	
	return 0;
 }      

 //可以看看我的
2024-01-26 14:04:55
大佬们,请问怎么理解tstar=6和dstar=8呀?
2022-04-01 10:12:18
让我写了60行的代码情何以堪
2022-03-31 22:37:47
大师你也太牛了
2022-03-31 22:37:21
  • «
  • 1
  • »