UVa 10008 - What's Cryptanalysis?
来源:互联网 发布:网络阅读的弊大于利 编辑:程序博客网 时间:2024/06/16 16:58
题目:统计字母出现的次数。
分析:简单题。简单的字符串处理。
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstdio>#include <string>using namespace std;typedef struct dnode{char c;int n;}data;data D[26];int cmp( data a, data b ){if ( a.n != b.n )return a.n > b.n;return a.c < b.c;}int main(){int n;char temp[1000];while ( ~scanf("%d",&n) ) {getchar();for ( int i = 0 ; i < 26 ; ++ i ) {D[i].c = 'A'+i;D[i].n = 0;}while ( n -- ) {gets(temp);for ( int i = 0 ; temp[i] ; ++ i ) {if ( temp[i] >= 'a' && temp[i] <= 'z' )temp[i] += 'A'-'a';if ( temp[i] >= 'A' && temp[i] <= 'Z' )D[temp[i]-'A'].n ++;}}sort( D, D+26, cmp );for ( int i = 0 ; i < 26 ; ++ i )if ( D[i].n ) printf("%c %d\n",D[i].c,D[i].n);else break;}return 0;}
- uva 10008 What's Cryptanalysis?
- UVA 10008 - What's Cryptanalysis?
- UVa 10008 - What's Cryptanalysis?
- UVA 10008 What's Cryptanalysis?
- uva 10008 What's Cryptanalysis?
- UVa OJ 10008-What's Cryptanalysis?
- UVa 10008 What's Cryptanalysis? (water ver.)
- 10008 - What's Cryptanalysis?
- What's Cryptanalysis?(map)
- E -What's Cryptanalysis?
- UVA, 10008 What's Cryptanalysis?(先按次数从大到小排列,后按照字典中的字母顺序)
- UVA 10008 whats cryptanalysis 水题
- (字符串的模式匹配4.7.8)UVA 10008 What's Cryptanalysis?(统计文本中某一个字符的出现的次数,需要从小到大排序&&同次数的按字段序排序)
- UVa 499 - What's The Frequency, Kenneth?
- what's
- Cryptanalysis of Microsoft's PPTP Authentication Extensions (MS-CHAPv2)
- what's wap 2.0
- what's love?
- 如何在Ubuntu上安装Mercurial的最新版本
- 百家乐怎么玩? 百家乐代打团队
- EXCEL 相同日期所在的不同单元格使用相同颜色
- absoulte position
- relative and static position
- UVa 10008 - What's Cryptanalysis?
- Let's move html
- 羽球步伐
- 车--提前量
- good js
- 《逆袭大学——传给IT学子的正能量》进展及最终目录
- examples on how to change the font(CSS)
- zhangmen.baidu.com/yuyu0year/4091183.html
- Matrix inverse