poj 百练2820(基础题)
来源:互联网 发布:高分数据是什么 编辑:程序博客网 时间:2024/05/17 23:18
2个星期没有练习
大致就是先对解密后的密码进行替换,然后看看字母是否一致,一致则可以移位完成
标准库里的sort
设置数组初值的memset
数组输入的scanf,gets
等等
#include <fstream>#include <string.h>#include <stdio.h>#include <algorithm>using std::sort;char code[101];char dcod[101];//全局数据bool Greater(int one, int two){ return one > two;}int main(){gets(code);gets(dcod);int nNumOne[26];int nNumTwo[26];memset(nNumOne, 0, sizeof(int) * 26);memset(nNumTwo, 0, sizeof(int) * 26);char* psz = code;while (*psz){++nNumOne[*psz - 'A'];++psz;}psz = dcod;while (*psz){++nNumTwo[*psz - 'A'];++psz;}sort(nNumOne, nNumOne + 26, Greater);sort(nNumTwo, nNumTwo + 26, Greater);bool bIsYes = true;for (int i = 0; i < 26; ++i){if (nNumOne[i] < nNumTwo[i]){bIsYes = false;break;}}if (bIsYes){printf("YES\n");}else{printf("NO\n");}return 0 ;}
- poj 百练2820(基础题)
- poj 百练2972(基础题)
- poj 百练(2735)基础题
- poj 百练2974(基础题)
- poj 百练2744( 基础题)
- poj 百练2975(基础题)
- poj 百练 2743(基础题)
- poj 百练 2976(基础题)
- poj 百练 2819(基础题)
- poj 百练 2797(基础题)
- poj 百练 2765(基础题)有难度
- poj 百练2973(基础题)
- poj 百练2734(基础题)
- poj 百练 2798(基础题)
- poj 百练 2742(基础题)
- poj 百练2799(基础题)
- C语言I/O小结 poj百练2804字典(基础题)
- poj 百练 2818
- 不用除法运算,实现A/3
- 公司以及环境以及学习模式
- jndi 数据源配置密码加密
- 自动切换IE代理设置: 简单使用IE自动配置脚本
- 对象持久化
- poj 百练2820(基础题)
- 自定义URL Protocol调用Winfrom程序(exe)并实现传值——类似网页链接调用QQ、旺旺
- 我的图片
- ssh Read from socket failed: Connection reset by peer
- UC故事 2012/05/07 Server文档
- jQuery中find()方法、children方法、filter()方法的区别分析
- 夏天到了~
- UESTCOJ 1655 Journey
- python之repr()和str()的区别