Vertical Histogram
来源:互联网 发布:office2016激活软件 编辑:程序博客网 时间:2024/06/05 20:58
M - Vertical Histogram
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu
Submit
Status
Description
Write a program to read four lines of upper case (i.e., all CAPITAL LETTERS) text input (no more than 72 characters per line) from the input file and print a vertical histogram that shows how many times each letter (but not blanks, digits, or punctuation) appears in the all-upper-case input. Format your output exactly as shown.
Input
* Lines 1..4: Four lines of upper case text, no more than 72 characters per line.
Output
* Lines 1..??: Several lines with asterisks and spaces followed by one line with the upper-case alphabet separated by spaces. Do not print unneeded blanks at the end of any line. Do not print any leading blank lines.
Sample Input
THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG.
THIS IS AN EXAMPLE TO TEST FOR YOUR
HISTOGRAM PROGRAM.
HELLO!
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
#include<stdio.h>#include<string.h>int main(){ int i,j,n,max=0; char a[4][99],k=0,b[99]={0}; for(i=0;i<4;i++) { gets(a[i]);//输入句子 } for(i=0;i<4;i++) { n=strlen(a[i]); for(j=0;j<n;j++) b[(int)a[i][j]-'A']++; } for(i=0;i<26;i++)//找出最高的数确定画图的行数 { if(b[i]>max) max=b[i]; } for(i=0;i<max;i++) { for(j=0;j<26;j++) { if(b[j]>=(max-i))//大于max-i就输出* printf("*"); else printf(" "); printf(" "); } printf("\n"); } printf("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\n");}
- Vertical Histogram
- Vertical Histogram
- Vertical Histogram
- Vertical Histogram
- Vertical Histogram
- Vertical Histogram
- POJ2136 Vertical Histogram
- PKU 2136 Vertical Histogram
- pku 2136 Vertical Histogram
- poj 2136 Vertical Histogram
- hdu 2708 Vertical Histogram
- poj 2136.Vertical Histogram
- POJ 2136 Vertical Histogram
- poj2136 Vertical Histogram
- POJ-2136 Vertical Histogram
- POJ 2136 Vertical Histogram
- Vertical Histogram垂直直方图
- Vertical Histogram-2136
- 关于安装Cocoapods的一般步骤
- [Leetcode 4] Median of Two Sorted Arrays
- UE4容器TArray、TMap的使用
- 用Promise让Node的异步任务顺序执行
- ACL(访问控制列表)基础篇
- Vertical Histogram
- 初识ReactJS的组件化开发(八):用表单做评论 :限制textarea可输入字符长度
- ue4中模式设定
- Python 获取磁盘信息的脚本
- Smarty模板技术学习
- java可变参数
- Smarty模板技术学习(二)
- File Nesting
- 在Express中使用html (Node.js)