poj 百练 2742(基础题)
2012-04-18 18:52
134 查看
#include <fstream> #include <string.h> #include <cstdio> using namespace std; #define _cdebbug //全局数据 int main() { //重定向 #ifdef _cdebbug freopen("F:\\input.txt","r",stdin ); #endif int n,i,j; char zifu[1002]; int cnt[26]; scanf("%d",&n); int len; int maxpos; while(n--) { for (i = 0; i < 26; ++i) cnt[i] = 0; scanf("%s",zifu); len = strlen(zifu); for(i = 0; i < len; ++i) { cnt[zifu[i] - 'a']++; } maxpos = 0; for(i = 0; i < 26; ++i) { if (cnt[i] > cnt[maxpos]) maxpos = i; } printf("%c %d\n",'a' + maxpos,cnt[maxpos]); scanf("%s",zifu); } //解除重定向关闭文件 #ifdef _cdebbug fclose(stdin); #endif return 0 ; }
统计字符
相关文章推荐
- POJ 3616 Milking Time(基础DP)
- POJ 1321 棋盘问题(基础题)
- poj_2367_Genealogical tree_很基础的拓扑排序
- POJ 2608 Soundex 基础题题解
- poj 3264 Balanced Lineup(基础线段树)
- POJ 2001 Shortest Prefixes(字典树基础)
- poj 1273 最大流 基础题 (内有最详细的最大流分析,很好入门)
- poj 1135 基础最短路
- POJ 3264 Balanced Lineup 线段树基础
- POJ1321棋盘问题 搜索基础题
- poj 百练2734(基础题)
- POJ 1163 The Triangle(基础DP)
- [NWPU][2014][TRN][5]二分和贪心 M - 贪心 基础 POJ 2709
- poj 1039 Pipe(几何基础)
- POJ 3009 基础搜索 DFS 四
- poj Wireless Network(基础并查集)
- poj 1050 To the Max(最大子矩阵之和,基础DP题)
- poj Cow Hurdles floyd基础题!!!!
- 【基础拓扑排序】poj 2376/ural 1022
- poj 2128 Popular Cows <2-sat基础scc强连通分量>