14. Strings

Previous lecture chores:

Makefile

Why:

Edit one file ⇒ compile one file + link all files

Makefile:

Not only compile, but any graph traversal/recreating

Strings

Important

There no such data type as strings

Conventional LibC string

C reference

H/W

  1. EJudge: QuickSquares 'Quick Squares'

    Input two positive integers — W and H, determining size of text screen. Then input a sequence of 5-value series x y width height c, where first 4 values are integers (coordinates of the top left corner of a rectangle and positive width and height of the rectangle), and 5th parameter is printable character. Output screen filled with '.' and all the rectangle draught in order by the corresponded characters. Upper left corner of screen has coordinates (0,0).

    Input:

    24 16
    2 0 4 8 * 
    0 2 14 12 #
    20 2 1 1 ! 
    10 11 8 5 + 
    3 4 21 7 @
    Output:

    ..****..................
    ..*..*..................
    ##############......!...
    #.*..*.......#..........
    #.*@@@@@@@@@@@@@@@@@@@@@
    #.*@.*.......#.........@
    #.*@.*.......#.........@
    #.*@**.......#.........@
    #..@.........#.........@
    #..@.........#.........@
    #..@@@@@@@@@@@@@@@@@@@@@
    #.........++++++++......
    #.........+..#...+......
    ##########+###...+......
    ..........+......+......
    ..........++++++++......
  2. EJudge: SlimSquares 'Slim Squares'

    Input series of four integers x y w h — position of top-level corner of the rectangle (maybe negative) and it's positive width and height (w and h ⩽ 50 each). The number of sequences is ⩽ 1000. Calculate and display total amount of area occupied by rectangles. Note the coordinates can be any possible integers.

    Input:

    1 1 5 10
    3 4 5 6
    0 7 12 5
    3 6 2 2
    Output:

    96
  3. TODO

HSE/ProgrammingOS/14_Strings (last edited 2020-04-07 18:08:04 by FrBrGeorge)