Loading environment...
Your friend Elliot is terrible at math and wants to cheat on his upcoming series test. Luckily, he was able to snag a look at the test paper by sneaking into the math office, but unfortunately, he was unable to find the answer sheet and forgot some terms. It's up to you, his dearly programmer friend, to find the -th term of each series he provides.
Elliot tried to copy the sequences from the test paper, but his notes are a complete disaster:
_).Your job is to extract the underlying series from this noisy data, decide whether it follows one of the three allowed patterns, and output the -th term.
The allowed patterns are:
Let be the number of known (non-_) entries. A pattern is considered valid if it matches strictly more than half () of those entries (i.e., matches known terms).
If two (or all three) patterns each satisfy the "> 50%" rule, they all count. Print their -th terms on one line, separated by the literal string OR (order does not matter).
If none of the three patterns meets the rule, print INVALID.
-3, 2.75).6.5, 3, 0.333333.The answer(s) are guaranteed to fit in a signed 64-bit integer if written as an exact rational (though they may be decimals when printed).
The input consists of two lines:
_ for missing terms.Constraints:
_ may appear anywhere.Output a single line containing:
OR (e.g., value1 OR value2) if several patterns are valid.INVALID if no pattern is valid.No comments yet. Be the first to comment!