1
1

More than 3 years have passed since last update.

ABC193 C - Unexpressed から学んだ

Posted at

abc193_1.png

うーん。さっぱり分からん。

abc193_2.png

20分悩んで降参。

なるほど。
a^2 <= N となるから a <= (N)^(0.5)が言える。。か。
想定される最大値 N と、想定される最小値 a^b(=a^2) の関係(不等式)から
a の条件を導き出している。

Unexpressed.py
N = int(input())
lis = []
for a in range(2,1+10**5):
    b = 2
    while True:
        if a**b <= N:
            lis.append(a**b)
            b += 1
        else:
            break
lis = set(lis) #二重の値を省く処理
print(N - len(lis))

勉強になりました。m(_ _)m

1
1
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
1
1