当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
… Los babilonios se entregaron al juego. El que no adquiría suertes era considerado un pusilánime, un apocado. Con el tiempo, ese desdén justificado se duplicó. Era despreciado el que no jugaba, pero también era despreciados los perdedores que abonaban la multa …
Jorge Luis Borges, La lotería de Babilonia, Ficciones
People of Babylon were devoted to chance games and one of the most popular was a special kind of roulette. Recently, some old Babylonian tablets were found. They described details of the roulette game.
In modern terms, the rules of the game were as follows:
-1, -2, -3, 1, 2, 3
.0, 1, 2, ...
Beside the tablets that explained the rules some other tablets were found. These had lines with three numbers. Archeologists conjecture that each of these lines were part of a kind of accountability system for the game, where numbers represented, for a given day, the value of the pot at the beginning, the bet and the value of the pot at the end.
For example, a line with the number
10000 1500 11500
could mean that there was only one turn where the player won with label 1
. Another possibility is that there were three turns with results 2
, 1
and -2
.
On the other hand, there were found other tablets with triplets of numbers that seem like the above described that, however, cannot represent results of a game day. There is no hypothesis of what they are.
Archeologists want to validate their hypothesis analyzing batches of tablets with triplets. They want to estimate the number of people that played in a day. To begin, they want to establish, for each triplet of numbers in a tablet that could represent a result of a game day, the minimal number of players that played that day. In the above example the answer to this question is 1
. Tablets that cannot represent results should be identified. You are hired to help with this task.
A line with a triplet of 0
’s denotes the end of the input.
Output texts for each input case are presented in the same order that input is read. For each test case the answer must be a printed line.
If the test case cannot represent the result of a game day, the output line has the words No accounting tablet
. In other case, the printed answer is one positive integer number telling the minimal number of players that could turn the roulette for the day corresponding to the annotations.
10000 1000 22000 24 13 2 5100 700 200 54 16 158 360 6 72 25 10 5 0 0 0
4 No accounting tablet 3 No accounting tablet 16 1
English translation of the Spanish preface:
… Babylonians flocked to buy tickets. The man who bought none was considered a pusillanimous wretch, a man with no spirit of adventure. In time, this justified contempt found a second target: not just the man who didn’t play, but also the man who lost and paid the fine. …
Jorge Luis Borges, The Lottery in Babylon
(cited from here)
时间上限 | 内存上限 |
1000 | 65536 |