Hdoj 2526 HDU 2526 romantic mobile phone ACM 2526 in HDU

Source: Internet
Author: User

Miyu original, post Please note: Reprinted from __________ White House

 

Question address:

Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2526

Description:


Romantic mobile phone

Time Limit: 3000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 362 accepted submission (s): 150

Problem description recently, wiskey has been fascinated by cell phone ringtones, but he does not know the audio laws very well, so he wondered if he could use a computer to randomly generate ringtones. When the wiskey is written Program Then it is found that the generated message is not a ringtone, but a noise!
After that, wiskey looked at some music scores and found that many ringtones changed regularly. to simplify this problem, he used three consecutive notes to judge the next one.
Mode

Given the first line of music score, the following music score is produced by mode:

We use 0 to represent the white lattice, and 1 to represent the black lattice.
For the edges without three consecutive grids (that is, there is no left grid or right grid), we use a white grid to replace the missing grid.

The first line of input has an integer T, which indicates that there are T groups of data.
Each group of data has an integer (M), indicating that the music score of m rows is to be output. Then there are eight lines of mode string, the left side is the note mode, and the right side is the next note. The last line is the first line of music score.

Output outputs m rows, indicating m rows of music.

Sample Input

 
116111 1110 1101 1100 1011 1010 0001 1000

Sample output

0000000000000001000000000000000000000000000001010000000000000000000000000001010100000000000000000000000001010101000000000000000000000001010101010000000000000000000001010101010100000000000000000001010101010101000000000000000001010101010101010000000000000001010101010101010100000000000001010101010101010101000000000001010101010101010101010000000001010101010101010101010100000001010101010101010101010101000001010101010101010101010101010001010101010101010101010101010101010101010101010101010101010101

 

Question Analysis:

The pure water simulation question ...... is the color of the middle block of the color of the above three grids. It can be directly output.

 The color of the first line has been given at the beginning of the question. The following can be directly launched to use hash to quickly determine.

CodeAs follows:

/*

Coded by: miyu

Link: http://www.cnblogs.com/MiYu | http://www.cppblog.com/MiYu

Author by: miyu

Test: 1

Program: 2526

*/

// # Pragma warning (Disable: 4789)

# Include <iostream>

# Include <cstdio>

# Include <cstring>

Using namespace STD;

Char C [2] [50];

Int T, T, M;

Int main (){

Char A [3], B [9];

For (INT I = 0; I <2; I ++) C [I] [0] = '0 ';

Scanf ("% d", & T );

While (t --){

Scanf ("% d", & M );

For (INT I = 1; I <= 8; I ++ ){

Scanf ("% s", );

Int num = (a [0]-'0') * 4 + (A [1]-'0') * 2 + A [2]-'0 ';

Scanf ("% d", & T );

B [num] = '0' + T;

}

Scanf ("% s", & C [0] [1]);

Int Len = strlen (& C [0] [1]);

For (INT I = 0; I <2; I ++) C [I] [Len + 1] = '0 ';

For (Int J = 0; j <m; j ++ ){

For (INT I = 0; I <Len; I ++ ){

Int num = (C [J % 2] [I]-'0') * 4 + (C [J % 2] [I + 1]-'0 ') * 2 + C [J % 2] [I + 2]-'0 ';

C [(j + 1) % 2] [I + 1] = B [num];

Printf ("% C", C [J % 2] [I + 1]);

}

Printf ("\ n ");

}

}

Return 0;

}

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.