题目描述部分只要看红字就好了!
1126: 第二章:我们都有梦想
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 491 Solved: 155
[Submit][Status][Web Board]Description
林静究竟在忙什么?暑假没有回家,现在打电话到他宿舍总是不在,郑微通过他的舍友给他留了自己的电话,也不见他回复。明明上火车的前两天郑微还跟林静通过电话,他在那一头答应得好好的,等她到了广州,他就会带她到处去玩,吃遍广州的小吃,当时郑微没有感觉到丝毫的异样,就连他的笑声也是一如既往地带着她熟悉的宠溺和宽容。
可是现在郑微没忘记两人的约定,林静却踪影全无。难道是她打错了电话?不可能!那个电话她倒着也能背出来,何况那边接电话的舍友明明也是认得林静的,只是说他不在。
不在不在,老是不在!还说是个模范好学生,不知道跑到哪鬼混去了!郑微气鼓鼓地想,等到见了面,非把他数落一顿不可。有点不高兴的郑薇手里拿着一封已经封上了口的信,里面写满了她想对林静说的话,但此时的她小心将信封撕开,想再看一遍写下时的那份甜蜜。
你要做的就是对一篇文章的字母进行统计。 而文章是由好多行字母,空格,标点组成的每行不会超过72个字符,请打印一个统计直方图来统计每个字母出现的次数 (不统计空行,数字,标点)。
Input
输入一份郑薇的甜言蜜语,只含有大小写字符,空格,标点。
Output
打印这一份甜蜜的统计图,具体如样例(最后不要空行)。
Sample Input
Amazing grace! How sweet the sound! That saved a wretch like me! I once was lost but now I am found, Was blind but now I see.
Sample Output
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
HINT
出国的林静并没有告诉郑薇任何消息。
这个是敲级模拟的题目了 。
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <map>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#define go(i,a,b) for(int i=a;i<=b;i++)
#define og(i,a,b) for(int i=a;i>=b;i--)
#define mem(a) memset(a,0,sizeof(a))
using namespace std;
const int inf=0x3f3f3f3f;
const int maxn = 1e2 + 5;
typedef long long ll;
char a[maxn];
int cnt[27];
int main()
{
mem(cnt);
while(scanf("%s",a) != EOF)
{
int len = strlen(a);
go(i,0,len-1)
{
a[i] = tolower(a[i]);
if(a[i] >= 'a' && a[i] <= 'z')
cnt[a[i] - 'a'] ++;
}
}
int Max = -1;
go(i,0,25)
{
if(cnt[i] > Max)
Max = cnt[i];
}
char show[Max][26];
go(i,0,Max-1)
{
go(j,0,25)
{
if(i > Max - 1 - cnt[j])
show[i][j] = '*';
else
show[i][j] = ' ';
}
}
go(i,0,Max-1)
{
go(j,0,25)
{
if(j != 0)
cout<<" ";
printf("%c",show[i][j]);
}
cout<<endl;
}
go(i,0,25)
{
if(i != 0)
cout<<" ";
printf("%c",'A' + i);
}
cout<<endl;
return 0;
}