B. 完美对称
来源:互联网 发布:拼音域名 编辑:程序博客网 时间:2024/05/21 19:55
B. 完美对称
我们把一个完全对称的字符串称为“完美对称”的字符串,请仔细观察字母表,判断给出的字符串是否“完美对称”。
Input
案例有多组,每组给出一个只由大小写字母组成的字符串,长度不大于1000。
Output
每行输出一个答案,如果给出的字符串位“完美对称”,输出“Yes”,否则,输出“No”。
Sample Input
AoA
aoa
Sample Output
Yes
No
#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<string>#include<algorithm>#include<stack>#include<queue>#include<cctype>#include<functional>using namespace std;#define swap(a,b) {long long c=a;a=b;b=c;}const int MAX = 999999;const double Eps = 1e-12;const double PI = acos(-1.0);int gcd(int x, int y){ return x%y == 0 ? y : gcd(y, x%y);}int main(){ int i, len, count; char a[2000], b[2000], c[2000]; memset(a, '\0', sizeof(a)); while (cin >> a) { count = 0; memset(b, '\0', sizeof(b)); memset(c, '\0', sizeof(c)); len = strlen(a); for (i = 0; i<len; i++) { if (a[i] == 'A') c[i] = 'A'; if (a[i] == 'b') c[i] = 'd'; if (a[i] == 'd') c[i] = 'b'; if (a[i] == 'H') c[i] = 'H'; if (a[i] == 'I') c[i] = 'I'; if (a[i] == 'M') c[i] = 'M'; if (a[i] == 'O') c[i] = 'O'; if (a[i] == 'o') c[i] = 'o'; if (a[i] == 'p') c[i] = 'q'; if (a[i] == 'q') c[i] = 'p'; if (a[i] == 'T') c[i] = 'T'; if (a[i] == 'U') c[i] = 'U'; if (a[i] == 'V') c[i] = 'V'; if (a[i] == 'v') c[i] = 'v'; if (a[i] == 'W') c[i] = 'W'; if (a[i] == 'w') c[i] = 'w'; if (a[i] == 'X') c[i] = 'X'; if (a[i] == 'x') c[i] = 'x'; if (a[i] == 'Y') c[i] = 'Y'; } for (i = 0; i < len; i++) b[i] = a[len - 1 - i]; if (!strcmp(b, c)) cout << "Yes" << endl; else cout << "No" << endl; } return 0;}
阅读全文
0 0
- B. 完美对称
- [JSOI2008]完美的对称{数论}
- CodeForces - 426B(对称图形)
- 【多关键字排序】完美的对称
- 洛谷 P1227 [JSOI2008]完美的对称
- 洛谷 P1227 [JSOI2008]完美的对称
- b牌棋盘完美覆盖
- PAT-B 1030. 完美数列
- PAT-B 1030. 完美数列
- nuc2016第一次月赛B。。对称素数
- ZBrush中的三种对称类型的完美运用
- 找规律-洛谷P1227 [JSOI2008]完美的对称
- 【B-Human】之无线网完美启动
- PAT-B 1030. 完美数列(25)
- hdu4512吉哥系列故事——完美队形I(对称的lcs)
- 计算几何瞎暴力——Luogu1227 [JSOI2008]完美的对称
- b/s结构的数值输入完美控制
- B/S程序中WEB打印的完美解决方案
- 使用SpringMVC配合jQuery文件上传插件ssi-uploader实现多图片可预览上传
- C. 城市重建
- 特长生模拟 采药(dp,背包)
- 【bzoj3224】Tyvj 1728 普通平衡树
- weka之初窥Instances类
- B. 完美对称
- extern略记
- CodeForces
- A. 奇数和
- 串口通信小结
- 关于二分查找法的一些问题
- Broadcast的最佳实践 强制下线
- POJ 1270 Following Orders 笔记
- java总结