编程介的小学生 2019-06-13 21:58 采纳率: 20.5%
浏览 179

五线谱上隐藏的得分的计算问题,要求使用C语言的编写的程序的代码怎么才能实现的呢

Problem Description
Do you like music? Let's play a game. I wrote down some notes on a piece of staff paper, then erase every other thing and leave only the notes. Can you guess what I wrote?

Fig 1. Names of Notes

If you're not familiar with music, take a look at the picture above. The vertical position of a note determines its name,
which is one of C, D, E, F, G, A and B, in this problem (yes, you don't have to consider notes in other octaves).
Consecutive lines in the staff have the same vertical distances. We call it one standard distance (sd), which is always between 1.0 and 5.0. For example, C and E are 1sd apart, and D and B are 2.5sd. The horizontal order of the notes
determines how the sequence is played (or sung). The exact horizontal positions do not matter, as long as the relative order is preserved. But since I never write down ugly scores, you can safely assume that the horizontal distance of an arbitrary pair of neighboring notes is at least 1sd and at most 5sd.

(a) Everything (b) The Notes (c) Note positions only

Fig 2. Transforming the original score into a hidden form

Figure 2(a) corresponds to the sequence EEECEG. Figure 2(b) shows the notes when other stuffs have been erased. Then, I rotate the paper and tell you the positions of the notes, shown in figure 2(c). Write a program to find my original music score, given the rotated positions of the notes. To make your life a little bit easier, I can tell you the name of the first and last note, and I promise that the answer could be uniquely determined. The rotation angle is an integer between -60 and 60 degrees (inclusive).

Input
The input consists of several test cases. The first line of each case contains one integer n (3 ≤ n ≤ 20) and two different capital letters from 'A' to 'G'. This is followed by n lines each containing two real numbers to eight decimal places, the rotated positions of each note. The notes can appear in any order. All the real numbers have absolute values not greater than 1000. The last test case is followed by a single zero, which should not be processed.

Output
For each test case, print the case number and recognized hidden score. The test cases are carefully designed such that floating error does not cause any problem.

Sample Input
6 E G
0.00000000 1.00000000
1.00000000 1.00000000
2.00000000 1.00000000
4.00000000 0.00000000
5.00000000 1.00000000
8.00000000 2.00000000
4 A C
0.00000000 15.62499286
11.28111236 5.80618831
20.63744497 6.54957842
37.94846083 0.00000000
7 B F
0.00000000 0.00000000
15.14798698 18.22443643
25.04608611 30.65582149
19.58478851 24.56084570
23.09216832 27.86533768
11.29672536 9.31513384
8.65999632 3.84492903
0

Sample Output
Case 1: EEECEG
Case 2: ADEC
Case 3: BDEGGFF

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python天天向上类似问题,但没有清零
    • ¥30 3天&7天&&15天&销量如何统计同一行
    • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
    • ¥15 C#调用python代码(python带有库)
    • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
    • ¥15 活动选择题。最多可以参加几个项目?
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题
    • ¥20 云服务Linux系统TCP-MSS值修改?
    • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)