QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73225 | #2939. Morse Code Palindromes | qdd# | AC ✓ | 3ms | 3488kb | C++20 | 1.3kb | 2023-01-23 06:47:33 | 2023-01-23 06:47:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
string mp[128];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
mp['a'] = ".-";
mp['b'] = "-...";
mp['c'] = "-.-.";
mp['d'] = "-..";
mp['e'] = ".";
mp['f'] = "..-.";
mp['g'] = "--.";
mp['h'] = "....";
mp['i'] = "..";
mp['j'] = ".---";
mp['k'] = "-.-";
mp['l'] = ".-..";
mp['m'] = "--";
mp['n'] = "-.";
mp['o'] = "---";
mp['p'] = ".--.";
mp['q'] = "--.-";
mp['r'] = ".-.";
mp['s'] = "...";
mp['t'] = "-";
mp['u'] = "..-";
mp['v'] = "...-";
mp['w'] = ".--";
mp['x'] = "-..-";
mp['y'] = "-.--";
mp['z'] = "--..";
mp['0'] = "-----";
mp['1'] = ".----";
mp['2'] = "..---";
mp['3'] = "...--";
mp['4'] = "....-";
mp['5'] = ".....";
mp['6'] = "-....";
mp['7'] = "--...";
mp['8'] = "---..";
mp['9'] = "----.";
string s, t;
getline(cin, s);
for (char c : s) {
if (('0' <= c && c <= '9') || ('a' <= c && c <= 'z')) {
t += mp[c];
} else if ('A' <= c && c <= 'Z') {
t += mp[c - 'A' + 'a'];
}
}
int n = t.length();
bool ok = 1;
for (int i = 0; i < n; i++) {
if (t[i] != t[n - 1 - i]) ok = 0;
}
cout << ((ok && n > 0) ? "YES\n" : "NO\n");
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3396kb
input:
hello
output:
NO
result:
ok single line: 'NO'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3352kb
input:
159
output:
YES
result:
ok single line: 'YES'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3460kb
input:
Madam I'm Adam
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
footstool
output:
YES
result:
ok single line: 'YES'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3452kb
input:
SOS
output:
YES
result:
ok single line: 'YES'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
e'UX73XB
output:
YES
result:
ok single line: 'YES'
Test #7:
score: 0
Accepted
time: 3ms
memory: 3424kb
input:
R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R
output:
YES
result:
ok single line: 'YES'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3384kb
input:
4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6
output:
YES
result:
ok single line: 'YES'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT
output:
YES
result:
ok single line: 'YES'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD
output:
NO
result:
ok single line: 'NO'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII
output:
YES
result:
ok single line: 'YES'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
mCu?&i8Nl
output:
NO
result:
ok single line: 'NO'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3408kb
input:
zDA%tcl
output:
NO
result:
ok single line: 'NO'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5
output:
YES
result:
ok single line: 'YES'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3484kb
input:
gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM
output:
YES
result:
ok single line: 'YES'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
NVXdeaCzadO6jo,lk?YLUkM
output:
NO
result:
ok single line: 'NO'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3488kb
input:
2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0
output:
NO
result:
ok single line: 'NO'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3452kb
input:
dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX
output:
YES
result:
ok single line: 'YES'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z
output:
NO
result:
ok single line: 'NO'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s
output:
NO
result:
ok single line: 'NO'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R
output:
NO
result:
ok single line: 'NO'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3416kb
input:
S!!!### ###!!!
output:
YES
result:
ok single line: 'YES'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3416kb
input:
A!!!### ###!!!
output:
NO
result:
ok single line: 'NO'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3384kb
input:
A!!!##N# ###!!!
output:
YES
result:
ok single line: 'YES'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
!!!#### .....,,,,???............##########################
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3384kb
input:
SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS
output:
YES
result:
ok single line: 'YES'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3384kb
input:
output:
NO
result:
ok single line: 'NO'