AtCoder Beginner Contest 174
翻译中…
Problem Statement
翻译中…
Takahashi loves the number $7$ and multiples of $K$.
翻译中…
Where is the first occurrence of a multiple of $K$ in the sequence $7,77,777,\ldots$? (Also see Output and Sample Input/Output below.)
翻译中…
If the sequence contains no multiples of $K$, print -1 instead.
翻译中…
Constraints
翻译中…
$1 \leq K \leq 10^6$$K$is an integer.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
K
翻译中…
Output
翻译中…
Print an integer representing the position of the first occurrence of a multiple of $K$. (For example, if the first occurrence is the fourth element of the sequence, print 4.)
翻译中…
样例
Input #1
101
Output #1
4
None of $7$, $77$, and $777$ is a multiple of $101$, but $7777$ is.
Input #2
2
Output #2
-1
All elements in the sequence are odd numbers; there are no multiples of $2$.
Input #3
999983
Output #3
999982
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。