UVA - 1339 Ancient Cipher
2015-06-23 13:41
387 查看
//
1.数组没初始化调了一下 还是直接输出数组
2.排序的时候元素没注意是26.
//
1.数组没初始化调了一下 还是直接输出数组
2.排序的时候元素没注意是26.
//
#include<iostream> #include<string.h> #include<algorithm> using namespace std; const int maxn = 100 + 5; int main() { char str1[maxn], str2[maxn]; while(cin >> str1 >> str2) { int len1 = strlen(str1); int len2 = strlen(str2); int cnt1[maxn], cnt2[maxn]; memset(cnt1,0,sizeof(cnt1)); memset(cnt2,0,sizeof(cnt2)); for(int i = 0; i < len1; ++i) cnt1[str1[i] - 'A']++; for(int i = 0; i < len2; ++i) cnt2[str2[i] - 'A']++; sort(cnt1, cnt1+26); sort(cnt2, cnt2+26); bool ok = true; for(int i = 0; i < 26; ++i) { if(cnt1[i] != cnt2[i]) { ok = false; break; } } if(ok) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
相关文章推荐
- css module.css demo
- poj 1338 Ugly Numbers
- 游走于技术前沿的“疯子们”
- GRE填空单词之精简版
- swift入门第一章常量、变量
- JNI之——编译时各种问题解决方案
- hdoj 1026 Ignatius and the Princess I 【BFS + 优先队列 + stack路径记录】 【经典题目】
- 在Android Studio中使用shareSDK进行社会化分享(图文教程)
- FPGrowth的java实现
- Date类型和Long类型的相互转换
- 第三次spring冲刺2
- 图像及视频基础知识
- socket基础
- CSS单行省略号
- sgu 219
- sgu 219 分类: sgu 2015-06-23 13:39 16人阅读 评论(0) 收藏
- Java多态性理解
- XmlPullParser解析xml数据
- 同步更新博客园
- 剑指Offer旋转数组中的最小数字