编程介的小学生 2017-09-04 14:39 采纳率: 20.5%
浏览 719
已采纳

Rose Shop

Problem Description
Small JH,the boss of the rose shop, preparated many roses for the valentine's day.It’s too much people come and buy roses,so Small JH have to put the roses back in every t(0 < t) minutes.The roses put as a thwartwise tower in the rail (look at the picture).You can get the number of rose with n(0<n<13) rows is n*(n + 1)/ 2.
a bundle of rose like this:

@
@~@~@
@~@\@/@~@
\@|@|@|@/
\|///
\|//
|/
=&=
/|\

This is the rose in the rail:

The rose numbered as below:

  1
2   3

4 5 6
7 8 9 10

The rule of putting the rose in is to find a empty bay where the number is smallest and put the rose in.We can suppose he add the rose spend no time,the customer should wait after Small JH add the rose.
The shop opened at 8:00am and closed at 11:00pm(the customer can buy rose at 11:00pm but the boss will not add the rose at 11:00pm).He want to know the situation of the customer buy the rose and the placement of rose after 11:00pm.If the customer see the shop is closed,he will leave.

Input
The input will consist of several cases, please deal with till the end of file. Each case contains three integers N , T and M (0<N<13, 0<T, 0<M<=100) representing there are N rows of roses,small JH add the rose every T minutes and M customer.Then follow M*2 lines as below format:
hh:mm k
a1 a2…ak
stand for at hh:mm the customer want to buy k roses,ai means he wants the rose numberd ai.at the same time,only one customer into the shop.
the time is increase and 0 < k <= n*(n + 1)/ 2, 0 < ai <= n*(n+1)/2.

Output
For each customer, when the shop Not yet opened,print “Not yet open for business”. if he can buy at least one rose,please print “You bought X beams of rose”.X means the number of the customer have bought.otherwise,print “What a pity!”.
After all, print the state of rose.

Sample Input
2 1 1
8:00 1
2
2 10000 1
8:00 1
2

Sample Output
You bought 1 beams of rose
+---------------------+
| @ |
| @~@~@ |
| @~@\@/@~@ |
| @ \@|@|@|@/ @ |
| @~@~@\|///@~@~@ |
|@~@\@/@~@|/@~@\@/@~@|
|\@|@|@|@/|/\@|@|@|@/|
| \|/// =&= \|/// |
| \|// /|\ \|// |
| |/ |/ |
| =&= =&= |
| /|\ /|\ |
+---------------------+
You bought 1 beams of rose
+---------------------+
| @ |
| @~@~@ |
| @~@\@/@~@ |
| \@|@|@|@/ @ |
| \|///@~@~@ |
| \|/@~@\@/@~@|
| |/\@|@|@|@/|
| =&= \|/// |
| /|\ \|// |
| |/ |
| =&= |
| /|\ |
+---------------------+

  • 写回答

1条回答 默认 最新

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

报告相同问题?

悬赏问题

  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站