問題一覧 > 通常問題

No.791 Ushi Sequence

レベル : / AI推定難易度 : 120 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 516
作問者 : treeone / テスター : ei1333333
お気に入りにしたユーザー ProblemId : 1817 / 自分の提出
問題文最終更新日: 2019-02-22 21:04:03
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 contest 206 (順位表) の他の問題:

Problem Statement

Let the $i$-th term of the sequence $E$ be $E_i = 1\underbrace{333\cdots 3}_{i 個}$ (the number which, in base $10$, is $1$ followed by $i$ occurrences of $3$), where $i$ is a positive integer.
Given an integer $N$, find which term of the sequence $E$ the integer $N$ is.
However, if $N$ does not appear in the sequence $E$, output $-1$.

Input

$N$

$1 \leq N \leq 10^{100}$
$N$ is an integer.

Output

Output the answer on $1$ line. Print a newline at the end.

Sample

Sample 1
Input
1333
Output
3

Sample 2
Input
1334
Output
-1

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。