Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -10,13 +10,13 @@ Decimal 6 = 3<sup>2</sup> − 3<sup>1</sup> + 0 × 3<sup>0</sup>, thus it can b
|
|||
;Task:
|
||||
Implement balanced ternary representation of integers with the following:
|
||||
# Support arbitrarily large integers, both positive and negative;
|
||||
# Provide ways to convert to and from text strings, using digits '+', '-' and '0' (unless you are already using strings to represent balanced ternary; but see requirement 5).
|
||||
# Provide ways to convert to and from text strings, using digits '+', '−' and '0' (unless you are already using strings to represent balanced ternary; but see requirement 5).
|
||||
# Provide ways to convert to and from native integer type (unless, improbably, your platform's native integer type ''is'' balanced ternary). If your native integers can't support arbitrary length, overflows during conversion must be indicated.
|
||||
# Provide ways to perform addition, negation and multiplication directly on balanced ternary integers; do ''not'' convert to native integers first.
|
||||
# Make your implementation efficient, with a reasonable definition of "efficient" (and with a reasonable definition of "reasonable").
|
||||
|
||||
|
||||
'''Test case''' With balanced ternaries ''a'' from string "+-0++0+", ''b'' from native integer -436, ''c'' "+-++-":
|
||||
'''Test case''' With balanced ternaries ''a'' from string "+−0++0+", ''b'' from native integer −436, ''c'' "+−++−":
|
||||
* write out ''a'', ''b'' and ''c'' in decimal notation;
|
||||
* calculate ''a'' × (''b'' − ''c''), write out the result in both ternary and decimal notations.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue