1100 - Mars Numbers Advanced Level

1100 Mars Numbers (20分)

People on Mars count their numbers with base 13:

  • Zero on Earth is called “tret” on Mars.
    The numbers 1 to 12 on Earth is called “jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec” on Mars, respectively.
  • For the next higher digit, Mars people name the 12 numbers as “tam, hel, maa, huh, tou, kes, hei, elo, syy, lok, mer, jou”, respectively.
  • For examples, the number 29 on Earth is called “hel mar” on Mars; and “elo nov” on Mars corresponds to 115 on Earth. In order to help communication between people from these two planets, you are supposed to write a program for mutual translation between Earth and Mars number systems.

Input Specification:
Each input file contains one test case. For each case, the first line contains a positive integer N (<100). Then N lines follow, each contains a number in [0, 169), given either in the form of an Earth number, or that of Mars.

Output Specification:
For each number, print in a line the corresponding number in the other language.

Sample Input:

4
29
5
elo nov
tam

Sample Output:

hel mar
may
115
13

重点就是别打错字呜呜 因为这个错了好几次

#include<bits/stdc++.h>
using namespace std;
map <string, int>a;
map <int, string>hb;
map <int, string>lb;
void init(){
	a["tret"] = 0;
	a["jan"] = 1;
	a["feb"] = 2;
	a["mar"] = 3;
	a["apr"] = 4;
	a["may"] = 5;
	a["jun"] = 6;
	a["jly"] = 7;
	a["aug"] = 8;
	a["sep"] = 9;
	a["oct"] = 10;
	a["nov"] = 11;
	a["dec"] = 12;
	a["tam"] = 1 * 13;
	a["hel"] = 2 * 13;
	a["maa"] = 3 * 13;
	a["huh"] = 4 * 13;
	a["tou"] = 5 * 13;
	a["kes"] = 6 * 13;
	a["hei"] = 7 * 13;
	a["elo"] = 8 * 13;
	a["syy"] = 9 * 13;
	a["lok"] = 10 * 13;
	a["mer"] = 11 * 13;
	a["jou"] = 12 * 13;
	
	lb[0] = "tret";
	lb[1] = "jan";
	lb[2] = "feb";
	lb[3] = "mar";
	lb[4] = "apr";
	lb[5] = "may";
	lb[6] = "jun";
	lb[7] = "jly";
	lb[8] = "aug";
	lb[9] = "sep";
	lb[10] = "oct";
	lb[11] = "nov";
	lb[12] = "dec";
	hb[1] = "tam";
	hb[2] = "hel";
	hb[3] = "maa";
	hb[4] = "huh";
	hb[5] = "tou";
	hb[6] = "kes";
	hb[7] = "hei";
	hb[8] = "elo";
	hb[9] = "syy";
	hb[10] = "lok";
	hb[11] = "mer";
	hb[12] = "jou";
}
void solve(string s){
	string s1, s2;
	s1 = s.substr(0, 3);
	int len = s.length();
	if(len > 4){
		s2 = s.substr(4, len - 4);
		cout << a[s1] + a[s2] << endl;
	}
	else cout << a[s1] << endl;
}
void solve1(int x){
	int x_, y_;
	if(x > 12){
		y_ = x / 13;
		x_ = x % 13;
		if(x_ != 0) cout << hb[y_] << " " << lb[x_] << endl;
		else cout << hb[y_] << endl; 
	}
	else {
		x_ = x;
		cout << lb[x_] << endl;
	}
	
}
int main()
{
	init();
	int T;
	cin >>T;
	getchar();
	string s;
	int x, len;
	while(T--){
		getline(cin, s);
		x = 0;
		len = s.length();
		if(s[0] >= '0' && s[0] <= '9') {
			for(int i = 0; i < len; i++){
				x = x * 10 + (s[i] - '0');
			}
			solve1(x);
		}
		else solve(s);
	}
	return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
校园失物招领系统管理系统按照操作主体分为管理员和用户。管理员的功能包括字典管理、论坛管理、公告信息管理、失物招领管理、失物认领管理、寻物启示管理、寻物认领管理、用户管理、管理员管理。用户的功能等。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。 校园失物招领系统管理系统可以提高校园失物招领系统信息管理问题的解决效率,优化校园失物招领系统信息处理流程,保证校园失物招领系统信息数据的安全,它是一个非常可靠,非常安全的应用程序。 ,管理员权限操作的功能包括管理公告,管理校园失物招领系统信息,包括失物招领管理,培训管理,寻物启事管理,薪资管理等,可以管理公告。 失物招领管理界面,管理员在失物招领管理界面中可以对界面中显示,可以对失物招领信息的失物招领状态进行查看,可以添加新的失物招领信息等。寻物启事管理界面,管理员在寻物启事管理界面中查看寻物启事种类信息,寻物启事描述信息,新增寻物启事信息等。公告管理界面,管理员在公告管理界面中新增公告,可以删除公告。公告类型管理界面,管理员在公告类型管理界面查看公告的工作状态,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值