编程介的小学生 2019-02-14 22:44 采纳率: 20.5%
浏览 276

反转对称矩阵的维度,采用C语言计算得到W的值

Problem Description
According to Wikipedia, a Walsh matrix is a specific square matrix, with dimensions equal to a power of 2, the entries of which are +1 or -1, and the property that the dot product of any two distinct rows (or columns) is zero. Below are the first three Walsh Matrices. (The gray lines are imaginary lines for illustration purpose only.)

A Walsh Matrix of size 2N+1 can be constructed as the ``union" of 4 Walsh Matrices of size 2N arranged such that the lower right matrix is inverted whereas the other 3 matrices are not, i.e.:

Let's number the rows of a given Walsh Matrix from the top starting with row 0. Similarly, let's number the columns of the matrix from the left starting with column 0. Given the four integers N , R , S , and E , write a program that will construct a Walsh Matrix of size 2N and will print the sum of all the numbers in row #R between columns #S and #E (inclusive.)

Input
Your program will be tested on one or more test cases. Each test case is specified using a single line listing four integers in the following order: N , R , S , and E , where 0<=N<=60 , 0<=R < 2^N , 0<=S<=E < 2^N , and E-S<=10, 000 . The last line of the input file has four -1's and is not part of the test cases.

Output
For each test case, print the output on a single line.

Sample Input
2 1 0 1
48 0 0 47
-1 -1 -1 -1

Sample Output
0
48

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题