No.220 The World's Something 2
タグ : / 解いたユーザー数 256
作問者 :
data9824
Problem Statement
Among the integers between \(1\) and \(10^P\) inclusive, output the count of numbers that are multiples of 3 or numbers containing a 3.
Note that a number that is both a multiple of 3 and a number containing a 3 is counted once.
Here, a "number containing a 3" is a number that has at least one digit equal to 3 in its decimal representation.
Input
P
\(1 \leq P \leq 19\)
Output
Output the count. Print a newline at the end.
Sample
Sample 1
Input
1
Output
3
Between 1 and 10 inclusive, the multiples of 3 and numbers containing a 3 are 3, 6, 9, for a total of 3 numbers.
Sample 2
Input
2
Output
45
Between 1 and 100 inclusive, the multiples of 3 and numbers containing a 3 are 3, 6, 9, 12, 13, 15, 18, 21, 23, 24, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 48, 51, 53, 54, 57, 60, 63, 66, 69, 72, 73, 75, 78, 81, 83, 84, 87, 90, 93, 96, 99, for a total of 45 numbers.
Sample 3
Input
19
Output
9099432188218005273
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。