UVa 1339: Ancient Cipher
来源:互联网 发布:淘宝刷单 php源码 编辑:程序博客网 时间:2024/06/06 20:32
#include <stdio.h>#include <stdlib.h>#include <string.h>int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b;}int main(){ char strA[100]; char strB[100]; char *tmp = NULL; while (scanf_s("%s", strA) != EOF) { int cnt1[26] = { 0 }; int cnt2[26] = { 0 }; scanf_s("%s", strB); int lenA = strlen(strA); int lenB = strlen(strB); for (tmp = strA; tmp < strA + lenA; tmp++) { cnt1[*tmp - 'A'] ++; } for (tmp = strB; tmp < strB + lenB; tmp++) { cnt2[*tmp - 'A'] ++; } if (lenA != lenB) { printf("NO\n"); return 0; } else { qsort(cnt1, 26, sizeof(int), cmp); qsort(cnt2, 26, sizeof(int), cmp); int i = 0; for (i = 0; i < 26; i++) { if (cnt1[i] != cnt2[i]) { printf("NO\n"); break; } else if (i == 25) { printf("YES\n"); } } } } return 0;}
0 0
- UVA 1339 - Ancient Cipher
- uva 1339 Ancient Cipher
- Uva - 1339 - Ancient Cipher
- UVA 1339 - Ancient Cipher
- UVa:1339 Ancient Cipher
- UVA 1339 - Ancient Cipher
- UVA-1339 - Ancient Cipher
- UVa 1339 Ancient Cipher
- UVa 1339 Ancient Cipher
- UVa 1339 - Ancient Cipher
- UVa 1339 - Ancient Cipher
- uva 1339Ancient Cipher
- UVa 1339 - Ancient Cipher
- Uva 1339 - Ancient Cipher
- 【Uva 1339】 Ancient Cipher
- UVa-1339 - Ancient Cipher
- Uva - 1339 - Ancient Cipher
- UVA - 1339 Ancient Cipher
- 基于SpringBoot + Mybatis实现SpringMVC Web项目【原创】
- UVa 489: Hangman Judge
- 关于C语言define宏定义字符串常量
- 最优化学习笔记(十七)——拟牛顿法(3)
- 内部类、匿名内部类和对象的初始化过程
- UVa 1339: Ancient Cipher
- Android数据存储的持久化技术
- UVA-4.3-救济金发放-133
- 算法训练 平方计算
- hdu Nightmare(BFS||DFS)(不标记的剪枝)
- 206. Reverse Linked List*
- FTP的主动传输和被动传输
- UVa 139: Ugly Numbers
- JVM进阶(三)——内存分配与回收策略