No.8028 Function Guessing
問題文最終更新日: 2020-04-01 19:12:38
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder April fool contest 2017
(順位表)
の他の問題:
Problem Statement
There exists a function $f: N \to N$. Given a positive integer $n$, compute and print $f(n)$.
We also want to check whether the body of the function is correct, so if -1 is given as $n$, print a Ruby implementation of the function $f(n)$.
(def and end are not needed. Print only the body.)
It is known that the body of the function $f(n)$, when written as a Ruby expression, contains no whitespace characters (spaces, newlines, tabs) and is at most 8 characters long. (Like
2*n-1or
123+n)
Also, the MD5 hash of the body of $f(n)$ (what is printed when $n=-1$), as a string excluding the newline, is 6ab55fc60c925306aa812f3763fbc1b7.
(*Warning!! This is an unusual problem. The answer cannot be uniquely determined from the problem statement and test cases. Do your best to guess it.)
(*Warning!! Solving this problem requires a Ruby implementation and knowledge of Ruby.)
Input
n
The input is a positive integer. It satisfies $1 \le n \le 10$ or $n = -1$.
Output
Print $f(n)$. Print a newline at the end.
Sample
Sample 1
Input
1
Output
2
Sample 2
Input
2
Output
4
Sample 3
Input
3
Output
9
Sample 4
Input
5
Output
37
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。