编程介的小学生 2017-04-06 02:16 采纳率: 0.2%
浏览 883
已采纳

Constellation

The constellation is very popular today. Many people believe that people with different constellations have different characters. Vivid asks you to help him calculate the distribution of constellations in his class.

You are given the birthdays of Vivid's classmates. Your program should print out a histogram to show the distribution of constellations.

The corresponding relationship between the constellations and the dates are listed below:
Aries - March 20th to April 20th
Taurus - April 21st to May 21st
Gemini - May 22nd to June 22nd
Cancer - June 23rd to July 22nd
Leo - July 23rd to August 22nd
Virgo - August 23rd to September 22nd
Libra - September 23rd to October 22nd
Scorpion - October 23rd to November 22nd
Sagitarius - November 23rd to December 22nd
Capricorn - December 23rd to January 21st
Aquarius - January 22nd to February 20th
Pisces - February 21st to March 19th

Notice: the histogram should show out the exact proportions, however, the height of each bar should be as short as possible (see the samples).

Input:

There are multiple test cases. Each test case begins with an integer N (the number of Vivid's classmates, 1 <= N <= 50), followed by N lines of strings indicating the birthdays of them. A birthday is represented by the month (an English word), a blank, and the date. You can assume all the birthdays are valid dates. A case with N = 0 indicates the end of input. Do not proceed this case.

Output:

For each test case, print the histogram to show the constellation distribution. See the sample outputs for directions. No trailing space is allowed. A blank line should be printed after each test case.

Sample Input:
4
March 19
March 20
March 19
March 20
19
March 19
March 20
March 20
March 19
March 19
March 20
March 20
March 19
March 19
March 20
March 20
March 19
March 19
March 20
March 20
March 19
March 19
March 20
March 20
0
Sample Output:
2 2

XX XX

Ar Ta Ge Ca Le Vi Li Sc Sa Ca Aq Pi

10
XX 9
XX XX
XX XX
XX XX
XX XX
XX XX
XX XX
XX XX
XX XX

XX XX

Ar Ta Ge Ca Le Vi Li Sc Sa Ca Aq Pi

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-18 15:45
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 iis10中如何阻止别人网站重定向到我的网站
  • ¥15 滑块验证码移动速度不一致问题
  • ¥15 定制ai直播实时换脸软件
  • ¥100 栈回溯相关,模块加载后KiExceptionDispatch无法正常回溯了
  • ¥15 Utunbu中vscode下cern root工作台中写的程序root的头文件无法包含
  • ¥15 麒麟V10桌面版SP1如何配置bonding
  • ¥15 Marscode IDE 如何预览新建的 HTML 文件
  • ¥15 K8S部署二进制集群过程中calico一直报错
  • ¥15 java python或者任何一种编程语言复刻一个网页
  • ¥20 如何通过代码传输视频到亚马逊平台