【鬼畜】UVA - 401每日一题·猛男就是要暴力打表

时间:2024-06-20 14:07:20

管他什么rev数组,msg数组简化代码

#define _CRT_SECURE_NO_WARNINGS
#include <cmath>
#include <iostream>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <cstring>
#include <time.h>
#include <string>
using namespace std;
#define rep(i,t,n) for(int i =(t);i<=(n);++i)
#define per(i,n,t) for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
const int maxn = + ;
const long long mod = 1e9 + ;
int n; int sum = ;
int a[maxn]; int vis[maxn];
bool cmp(int a, int b) { return a > b; }
char M[]; bool mirror(string s) {
int len = s.length();
rep(i, , len - ) {
if (s[i] != M[s[len- - i]])return ;
}
return ;
}
bool palin(string s) {
int len = s.length();
rep(i, , len - ) {
if (s[i] != s[len- - i])return ;
}
return ;
} int main() {
M['A'] = 'A'; M['E'] = ''; M['M'] = 'M'; M['O'] = 'O'; M['S'] = ''; M['T'] = 'T'; M['U'] = 'U'; M['V'] = 'V'; M['W'] = 'W'; M['X'] = 'X'; M['Y'] = 'Y'; M['Z'] = ''; M[''] = ''; M[''] = 'S'; M[''] = 'E'; M[''] = 'Z'; M[''] = ''; M['L'] = 'J'; M['J'] = 'L'; M['I'] = 'I'; M['H'] = 'H';
string ss; while (cin>>ss) {
int f1 = , f2 = ;
if (mirror(ss))f1 = ;
if (palin(ss))f2 = ;
cout << ss;
if (f1&&f2)puts(" -- is a mirrored palindrome.");
else if (f1 && !f2)puts(" -- is a mirrored string.");
else if (!f1&&f2)puts(" -- is a regular palindrome.");
else puts(" -- is not a palindrome.");
cout << endl;
} //cin >> n;
} /*
3
4 1 1 1 1
5 10 20 30 40 50
8 1 7 2 6 4 4 3 5 1
3
1 1 2
A A M M Y Y
B N Z 5
C O O 1 1
D P 2 S
E 3 Q 3 E
F R 4
G S 2 5 Z
H H T T 6
I I U U 7
J L V V 8 8
K W W 9
L J X X
*/