QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#711228 | #2939. Morse Code Palindromes | BackToSquare1 | AC ✓ | 0ms | 3836kb | C++20 | 2.2kb | 2024-11-05 04:58:11 | 2024-11-05 04:58:11 |
Judging History
answer
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef pair<ld,ld> pd;
typedef vector<ll> vl;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define G(x) ll x; cin >> x;
#define F(i, l, r) for (ll i = l; i < (r); ++i)
#define all(a) begin(a), end(a)
#define K first
#define V second
#define OK(i,j) i >= 0 && i < n && j >= 0 && j < m
#define NN 2505
#define MM 5005
#define MOD 1000000007
map<char,string> m;
void solve() {
m['A'] = ".-";
m['B'] = "-...";
m['C'] = "-.-.";
m['D'] = "-..";
m['E'] = ".";
m['F'] = "..-.";
m['G'] = "--.";
m['H'] = "....";
m['I'] = "..";
m['J'] = ".---";
m['K'] = "-.-";
m['L'] = ".-..";
m['M'] = "--";
m['N'] = "-.";
m['O'] = "---";
m['P'] = ".--.";
m['Q'] = "--.-";
m['R'] = ".-.";
m['S'] = "...";
m['T'] = "-";
m['U'] = "..-";
m['V'] = "...-";
m['W'] = ".--";
m['X'] = "-..-";
m['Y'] = "-.--";
m['Z'] = "--..";
m['0'] = "-----";
m['1'] = ".----";
m['2'] = "..---";
m['3'] = "...--";
m['4'] = "....-";
m['5'] = ".....";
m['6'] = "-....";
m['7'] = "--...";
m['8'] = "---..";
m['9'] = "----.";
string s;
getline(cin,s);
string t = "";
ll ct = 0;
ll k = s.length();
for(ll i=0;i<k;i++) {
if(s[i] >= 'A' && s[i] <= 'Z') {
t += m[s[i]];
ct++;
}
else if(s[i] >= '0' && s[i] <= '9') {
t += m[s[i]];
ct++;
}
else if(s[i] >= 'a' && s[i] <= 'z') {
t += m[(s[i] - 'a' + 'A' + 128)%128];
ct++;
}
}
if(ct == 0) {
cout << "NO\n";
return;
}
string u = t;
reverse(u.begin(),u.end());
if(u == t) cout << "YES\n";
else cout << "NO\n";
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3820kb
input:
hello
output:
NO
result:
ok single line: 'NO'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
159
output:
YES
result:
ok single line: 'YES'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
Madam I'm Adam
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
footstool
output:
YES
result:
ok single line: 'YES'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
SOS
output:
YES
result:
ok single line: 'YES'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
e'UX73XB
output:
YES
result:
ok single line: 'YES'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
R2WE&s?FI$ggAvgZQKDMJIAUKDAESIME8R
output:
YES
result:
ok single line: 'YES'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4n'dA9KqAO.3ghkPLZ9?B e,h%3RmjCENTTQC75IA1IMFATRN4O3MEYNN0SK6
output:
YES
result:
ok single line: 'YES'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
zvnoMVQM4ZeCgYu;PxkjHSWKWUACWAPNTSOHOJ3OWEESTT
output:
YES
result:
ok single line: 'YES'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3n2B0?nJ8s$XYv8:P,S%8q78OtJemC2fs39?BAHjZvNut1iYPCMm%Nh5AHKE5PqMfIDHg8AD
output:
NO
result:
ok single line: 'NO'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
h3yH6eTyv;enjUAzi9F%LsMB S$I47IDDEOTIUTCWNENNIMPSAIUNOSII
output:
YES
result:
ok single line: 'YES'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
mCu?&i8Nl
output:
NO
result:
ok single line: 'NO'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
zDA%tcl
output:
NO
result:
ok single line: 'NO'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
5rjGHXsxk&1:ms7M,;CsHTJ3EE1MEYEREL6AOTF5
output:
YES
result:
ok single line: 'YES'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
gsNbp1VyHZ'bw$kVNKo.:FOVwGDATK2CTTEERMTHDT6MATEITTZ7RBEM
output:
YES
result:
ok single line: 'YES'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
NVXdeaCzadO6jo,lk?YLUkM
output:
NO
result:
ok single line: 'NO'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
2z?&PcYWbfxM.V0KRtfnoceK;U$4hV&yEp1pMMV4IAyiU5GN1ilY0
output:
NO
result:
ok single line: 'NO'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
dYq06,'k3FF6R'Hp6ji1BOY,yw2wpWWWDTKYNTMN2TTSMBUWI4EIFTEEAUTIRBJONMMEX
output:
YES
result:
ok single line: 'YES'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
p5OKcG:is CZVARdi08;Lm?6ar3NXN3mRh,NclzLuqA,VBFzGin 8z
output:
NO
result:
ok single line: 'NO'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
M:AqX&, &D.if0GES7gDzPRJlnzUnsOPnr:N:s
output:
NO
result:
ok single line: 'NO'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
Rheh6SB8gCEv%7:ej0HN'JvpS,XIwPr1%&l&'R
output:
NO
result:
ok single line: 'NO'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
S!!!### ###!!!
output:
YES
result:
ok single line: 'YES'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
A!!!### ###!!!
output:
NO
result:
ok single line: 'NO'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
A!!!##N# ###!!!
output:
YES
result:
ok single line: 'YES'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
!!!#### .....,,,,???............##########################
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
SSSSSSSSSSSSSSSSSSSSOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSSSSSSSSSSSSSSSSSSSS
output:
YES
result:
ok single line: 'YES'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
output:
NO
result:
ok single line: 'NO'