QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#812335#2939. Morse Code Palindromesrlc202204AC ✓1ms3816kbC++141.3kb2024-12-13 14:19:142024-12-13 14:19:15

Judging History

This is the latest submission verdict.

  • [2024-12-13 14:19:15]
  • Judged
  • Verdict: AC
  • Time: 1ms
  • Memory: 3816kb
  • [2024-12-13 14:19:14]
  • Submitted

answer

#include <iostream>
#include <cstdio>
#include <map> 
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

map<char, string> mp;

int main() {
//	for (int i = 0; i < 26; i++) {
//		printf("mp['%c'] = \"\";\n", char(i + 'A'));
//	}
	mp['A'] = "01";
	mp['B'] = "1000";
	mp['C'] = "1010";
	mp['D'] = "100";
	mp['E'] = "0";
	mp['F'] = "0010";
	mp['G'] = "110";
	mp['H'] = "0000";
	mp['I'] = "00";
	mp['J'] = "0111";
	mp['K'] = "101";
	mp['L'] = "0100";
	mp['M'] = "11";
	mp['N'] = "10";
	mp['O'] = "111";
	mp['P'] = "0110";
	mp['Q'] = "1101";
	mp['R'] = "010";
	mp['S'] = "000";
	mp['T'] = "1";
	mp['U'] = "001";
	mp['V'] = "0001";
	mp['W'] = "011";
	mp['X'] = "1001";
	mp['Y'] = "1011";
	mp['Z'] = "1100";
	mp['0'] = "11111";
	mp['1'] = "01111";
	mp['2'] = "00111";
	mp['3'] = "00011";
	mp['4'] = "00001";
	mp['5'] = "00000";
	mp['6'] = "10000";
	mp['7'] = "11000";
	mp['8'] = "11100";
	mp['9'] = "11110";
	string s;
	getline(cin, s);
	
	string t = "";
	for (auto i: s)
		if (isalpha(i)) {
			t += toupper(i);
		}
		else if (isdigit(i))
			t += i;
	s = t;
	if ((int)s.size() == 0) {
		printf("NO\n");
		return 0;
	}
	string a = "", b = "";
	for (auto i: s)
		a += mp[i];
	b = a;
	reverse(b.begin(), b.end());
	if (a == b)
		cout << "YES";
	else
		cout << "NO";
	return 0;
} 

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

hello

output:

NO

result:

ok single line: 'NO'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

159

output:

YES

result:

ok single line: 'YES'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

Madam I'm Adam

output:

NO

result:

ok single line: 'NO'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

footstool

output:

YES

result:

ok single line: 'YES'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

SOS

output:

YES

result:

ok single line: 'YES'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3468kb

input:

e'UX73XB

output:

YES

result:

ok single line: 'YES'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R

output:

YES

result:

ok single line: 'YES'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6

output:

YES

result:

ok single line: 'YES'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3476kb

input:

zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT

output:

YES

result:

ok single line: 'YES'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD

output:

NO

result:

ok single line: 'NO'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII

output:

YES

result:

ok single line: 'YES'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

mCu?&i8Nl

output:

NO

result:

ok single line: 'NO'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

zDA%tcl

output:

NO

result:

ok single line: 'NO'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5

output:

YES

result:

ok single line: 'YES'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM

output:

YES

result:

ok single line: 'YES'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

NVXdeaCzadO6jo,lk?YLUkM

output:

NO

result:

ok single line: 'NO'

Test #17:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0

output:

NO

result:

ok single line: 'NO'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX

output:

YES

result:

ok single line: 'YES'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z

output:

NO

result:

ok single line: 'NO'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s

output:

NO

result:

ok single line: 'NO'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R

output:

NO

result:

ok single line: 'NO'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

S!!!### ###!!!

output:

YES

result:

ok single line: 'YES'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

A!!!### ###!!!

output:

NO

result:

ok single line: 'NO'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

A!!!##N# ###!!!

output:

YES

result:

ok single line: 'YES'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

!!!####  .....,,,,???............##########################

output:

NO

result:

ok single line: 'NO'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS

output:

YES

result:

ok single line: 'YES'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:



output:

NO

result:

ok single line: 'NO'