有大佬能帮我看看哪里的问题?(互关)
  • 板块B3617 古籍翻译
  • 楼主3_14
  • 当前回复8
  • 已保存回复8
  • 发布时间2024/4/16 22:23
  • 上次更新2024/4/17 13:26:26
查看原帖
有大佬能帮我看看哪里的问题?(互关)
913288
3_14楼主2024/4/16 22:23

第十一个测试点错了100分,没AC.

#include<bits/stdc++.h>
using namespace std;
string s;
map<char,string>o_t;
map<string,string>t_s;
void tii(){
	o_t['1']="001",o_t['2']="010",o_t['3']="011";
	o_t['4']="100",o_t['5']="101",o_t['6']="110";
	o_t['7']="111",o_t['0']="000";
	t_s["0000"]="0";
	t_s["0001"]="1",t_s["0010"]="2",t_s["0011"]="3";
	t_s["0100"]="4",t_s["0101"]="5",t_s["0110"]="6";
	t_s["0111"]="7",t_s["1000"]="8",t_s["1001"]="9";
	t_s["1010"]="a",t_s["1011"]="b",t_s["1100"]="c";
	t_s["1101"]="d",t_s["1110"]="e",t_s["1111"]="f";
}
int main(){
	cin>>s;
	tii();
	string two="",ans="";
	for(int i=0;i<s.size();i++)
		two+=o_t[s[i]];
	int len=two.size(),c=4-len%4;
	len+=c;
	if(c>0){
		while(c--)
			two="0"+two;
	}
	len+=c;
	for(int i=0;i<len;i+=4){
		string cnt=two.substr(i,4);
		ans+=t_s[cnt];
	}
	int bi_id=0;
	while(ans[bi_id]=='0')
		bi_id++;
	for(int i=bi_id;i<ans.size();i++)
		cout<<ans[i]; 
	return 0;
}
2024/4/16 22:23
加载中...