Meaning of the questions is very simple, but it is thought would be around, a method of digital printing in general to achieve is similar to the calculator display numbers, all numbers can be reduced by a certain number 8 strokes come. All strokes, the size of each string array string of thought to this question is to use an array of strings are stored 0-9 7, are stored seven strokes (strokes and some figures are not space-occupying) .
Analysis of constituent features eight digital (counting left to right from top to bottom), the first of 036 strokes are horizontal (-), 1, 4 strokes for the left vertical (|), 2 and 5 vertical strokes to the right. It can be extended to other figures, numeral 8 and the like are also features.
Topics requirements:
Input Format
The first line k. k pledged to put digital size.
The second line comprised solely of digits of the string, that is, to put a few numbers.
Output Format
press
Sample input and output
2 1234567890
-- -- -- -- -- -- -- -- | | | | | | | | | | | | | | | | | | | | | | | | | | | | -- -- -- -- -- -- -- | | | | | | | | | | | | | | | | | | | | | | | | | | -- -- -- -- -- -- --
Description / Tips
Questions asked Output
Attach Code: 2019-08-17
1 #include <bits/stdc++.h> 2 using namespace std; 3 int main() 4 { 5 int k; 6 string s,m[10]={"-|| ||-"," | | ","- |-| -", 7 "- |- |-"," ||- | ", "-| - |-","-| -||-", 8 "- | | ", " - || - || - " , " - || - | - " }; . 9 CIN >> >> K S; 10 for ( int P = 0 ; P < . 7 ; P ++) // each number seven strokes, the stroke numbers 8 full, when the remaining number of strokes is not replaced by a space . 11 { 12 is IF (P == 2 || P == . 5 ) Continue ; // 2. 5 to the right of the vertical line, put in the following treatment with 13 is IF (% P . 3 == 0 ) { // 0. 3. 6 is a horizontal strokes 14 for ( int I =0 ; I <s.size (); I ++ ) { 15 COUT << ' ' ; // interval between each horizontal line 16 for ( int J = 0 ; J <K; J ++) { // controls each there are several pen strokes . 17 COUT m << [S [I] - 48 ] [P]; // S [I] -48 is converted to numeric character 18 is } . 19 COUT << " " ; 20 is } 21 is COUT << endl ; 22 is } the else { // . 1. 4. 5 vertical 2 23 is for ( int Q = 0 ; Q <K; Q ++) { // controls each stroke of a few strokes 24 for ( int I = 0 ; I <s.size (); I ++ ) { 25 COUT m << [S [I] - 48 ] [P]; // output left vertical line 26 is for ( int J = 0 ; J <K; J ++) { // required stroke frequency control 27 COUT << ' ' ; // each small spaces between the strokes 28 } 29 COUT m << [S [I] - 48 ] [P +1 ] << ' ' ; // output of the right vertical line 30 } 31 is COUT << endl << endl; // The number of strokes required output when the vertical line, the vertical line between the empty row is repeated 32 } 33 } 34 } 35 return 0 ; 36 }