0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ABC186 C - Unlucky 7 から学んだ

Last updated at Posted at 2021-09-17

abc186_1.png

abc186_2.png

とりあえず、8 進数への変換は基本文字列。
10 進数も文字列へ統一した方が楽そうだ。

こんな記述でも通った。

Unlucky.py
N = int(input())
lis = []
for n in range(1,N+1):#O(10^5)
    if "7" in str(n) or "7" in oct(n):#worst O(12)
        lis.append(str(n))
print(N-len(set(lis)))
#total O(12*10^5)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?