P0007. Egyptian numbers P89342


Statement
 

pdf   zip

thehtml

This problem can not be seen correctly in HTML. Consult the PDF or the PS.

Input

The input is a sequence of cases, each one in a line. Every line starts with a word that identifies it, and continues with a sequence of natural numbers ending with −1. The sum of the natural numbers of each sequence will have seven digits at most.

Output

For each input case, print the identifier, followed by the stamp corresponding to the sum of the natural numbers of the case. Your program must print an empty line after each case.

Public test cases
  • Input

    isis 1333330 -1
    osiris 4622 -1
    tutankamon 6 6 0 45 3000 14 -1
    papirus -1
    ra 0 9999999 0 -1
    

    Output

    isis
    +---------+
    |G        |
    |FFF      |
    |EEE      |
    |DDD      |
    |CCC      |
    |BBB      |
    +---------+
    
    osiris
    +---------+
    |DDDD     |
    |CCCCCC   |
    |BB       |
    |AA       |
    +---------+
    
    tutankamon
    +---------+
    |DDD      |
    |BBBBBBB  |
    |A        |
    +---------+
    
    papirus
    +---------+
    +---------+
    
    ra
    +---------+
    |GGGGGGGGG|
    |FFFFFFFFF|
    |EEEEEEEEE|
    |DDDDDDDDD|
    |CCCCCCCCC|
    |BBBBBBBBB|
    |AAAAAAAAA|
    +---------+
    
    
  • Information
    Author
    Professorat de P1
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++