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

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 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料