[2018 Blue Bridge Cup preliminary] codes (binary 10 turns the bitset)

Title Description

Chinese character font exists in the font, even today, 16 dot matrix font is still widely used.
16 dot matrix font to each character as a 16x16 pixel information. And these information is recorded in bytes.
A byte can store 8 bits of information, 32 bytes with a character can keep the glyph.
Each byte into the represented binary, represents an ink, 0 represents background. 2 bytes per row,
a total of 16 lines, layout:
    1 byte, 2 bytes
    3 bytes 4 bytes of
    ....
    31 byte, 32 byte
This question is to you plurality piece of information consisting of characters, each character is represented by 32 bytes, a byte as given herein have signed integer values.
Hidden in the subject requires this information. Your task is to restore the shape of Chinese characters, seen from the requirements of the subject, and fill in the answers on request.

Entry

No input, the information is given (a 10 characters):
4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0 
16 64 16 64 34 68 127 126 66 -124 67 4 66 4 66 -124 126 100 66 36 66 4 66 4 66 4 126 4 66 40 0 16 
4 0 4 0 4 0 4 32 -1 -16 4 32 4 32 4 32 4 32 4 32 8 32 8 32 16 34 16 34 32 30 -64 0 
0 -128 64 -128 48 -128 17 8 1 -4 2 8 8 80 16 64 32 64 -32 64 32 -96 32 -96 33 16 34 8 36 14 40 4 
4 0 3 0 1 0 0 4 -1 -2 4 0 4 16 7 -8 4 16 4 16 4 16 8 16 8 16 16 16 32 -96 64 64 
16 64 20 72 62 -4 73 32 5 16 1 0 63 -8 1 0 -1 -2 0 64 0 80 63 -8 8 64 4 64 1 64 0 -128 
0 16 63 -8 1 0 1 0 1 0 1 4 -1 -2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 5 0 2 0 
2 0 2 0 7 -16 8 32 24 64 37 -128 2 -128 12 -128 113 -4 2 8 12 16 18 32 33 -64 1 0 14 0 112 0 
1 0 1 0 1 0 9 32 9 16 17 12 17 4 33 16 65 16 1 32 1 64 0 -128 1 0 2 0 12 0 112 0 
0 0 0 0 7 -16 24 24 48 12 56 12 0 56 0 -32 0 -64 0 -128 0 0 0 0 1 -128 3 -64 1 -128 0 0 

Export

Output meaning of the questions correct answer
 

The answer 387,420,489

Meaning of the questions:

After the number of the input line 32, in order to convert each of the two 8-bit binary numbers spliced ​​into the output line, the number of the composition 32 32/2 = 16 rows, may represent a character just

A total of 10 line inputs, contains information about a problem (how many square nine nine equal?), The output answer to this question

 

answer

bitset <8> t implemented converting a binary number into a decimal number (including negative), then if they convert much trouble (positive becomes negative, binary rotation, plus a negation)

#include <the iostream> 
#include <cstdio> 
#include <the bitset> 
#include <the cmath> 
 the using  namespace STD;
 int main () 
{ 

    the bitset < . 8 > T; // comprises a negative binary number revolutions, t can be used as a function 
    for ( int I = 0 ; I < 10 ; ++ I) 
    { 
        for ( int J = 0 ; J < 16 ; ++ J) 
        { 
            int X, Y;
             String A, B; 
            Scanf ( " % D% D" , & X, & Y); 
            t = X; A = t.to_string (); // converted into binary numbers 8 to t first integer x, in converting to a string t 
            t = Y; B = t. the to_string (); 
            A + B =; // string concatenation 
            for ( int K = 0 ; K <a.length (); ++ K) 
            { 
                IF (A [K] == ' . 1 ' ) { 
                    the printf ( " * " ); 
                } 
                the else { 
                    the printf ( "  " ); 
                } 
            }
            printf("\n");
        }
    }

    
    long long ans = pow(9, 9);
    printf("%lld", ans);
    return 0;
 } 

 

 

 

Guess you like

Origin www.cnblogs.com/-citywall123/p/12486439.html