Problem:


Score : 200 points

Problem Statement

Given is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).

Constraints

1 \leq N \leq 10^5

Input

Input is given from Standard Input in the following format:

N

Output

Print the number of positive integers less than or equal to N that have an odd number of digits.

Sample Input 1

11

Sample Output 1

9

Among the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \ldots, 9.

Sample Input 2

136

Sample Output 2

46

In addition to 1, 2, \ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \ldots, 136.

Sample Input 3

100000

Sample Output 3

90909



Sample input:
11


Sample output:
9

Submission status: Accepted

Solution code:
n=int(input())
ans=0
if ((n>=1) & (n<=9)):
    ans=n
elif ((n>=10) & (n<=99)):
    ans=9
elif ((n>=100) & (n<=999)):
    ans=n-90
elif ((n>=1000) & (n<=9999)):
    ans=909
elif ((n>=10000) & (n<=99999)):
    ans=n-9090
else:
    ans=90909
    
print(ans)

Submission status: Accepted

Solution code:
#abc136B - Uneven Numbers
N = int(input())
count = 0
for i in range(1,N+1,1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
c=0
for i in range(1,int(input())+1):
    if len(str(i))%2==1:
        c+=1
print(c)

Submission status: Accepted

Solution code:
N = int(raw_input())
ans = 0
for i in range(1,N+1):
  if len(str(i)) % 2 == 1:
    ans = ans + 1
print ans

Submission status: Accepted

Solution code:
N = input()

ans = 0

while True:
    if len(N) == 6:
        N = str(99999)
    if len(N) == 5:
        ans += int(N) - 9999
        N = str(999)
    if len(N) == 4:
        N = str(999)
    if len(N) == 3:
        ans += int(N) - 99
        N = str(9)
    if len(N) == 2:
        N = str(9)
    if len(N) == 1:
        ans += int(N)
        break
    
print(ans)

Submission status: Accepted

Solution code:
n=input()
l=len(n)
a="090909"[:l]
print(a[1:] if l %2 ==0 else int(n)-int(a))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1):
  if len(str(i)) % 2 ==1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
if n < 10:
  print(n)
elif n < 100:
  print(9)
elif n < 1000:
  print(9 + n - 99)
elif n < 10000:
  print(9 + 900)
elif n < 100000:
  print(9 + 900 + n - 9999)
else:
  print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
#coding: utf-8

N = input()
count = 0
for i in range(1, int(N)+1):
    if(len(str(i)) % 2 == 1):
        count = count + 1

print(count)

Submission status: Accepted

Solution code:
import math
n=int(input())
k=int(math.log10(n)//1+1)

if k%2==0:
    ans=0
    for i in range(1,k,2):
        ans+=10**i-10**(i-1)
    print(ans)
else:
    ans=n-10**(k-1)+1
    for i in range(1,k,2):
        ans+=10**i-10**(i-1)
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())

c = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 != 0:
    c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
print(len([l for l in list(map(str,range(1,n+1))) if len(l)%2==1]))

Submission status: Accepted

Solution code:
n =int(input())
ans = 0
for i in range(1,n+1):
    if len(str(i))%2 ==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=input()
int_N=int(N)

ans=0

for i in range(0,len(N)-1,2):
    ans=ans+10**(i+1)-10**(i)

if len(N)%2!=0:
    ans=ans+int_N-10**(len(N)-1)+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0
flag = True
for i in range(1, n + 1):
    if i == 10 or i ==100 or i==1000 or i==10000 or i ==100000or i==1000000:
        if flag:
            flag = False
        else:
            flag = True

    if flag:
        # print(i)
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N =int(input())
if N >=10 and N<=99:
  print(9)
elif N >=100 and N<=999:
  print(N-90)
elif N >= 1000 and N<= 9999:
  print(9 + 900)
elif N >= 10000 and N<= 99999:
  print(N-90-9000)
elif N == 100000:
  print(9 + 900 + 90000)
else:
  print(N)

Submission status: Accepted

Solution code:
N = int(input())

answer = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        answer += 1

print(answer)

Submission status: Accepted

Solution code:
N = str(int(input()))
total = 0
digits = [i for i in range(len(N)) if i != 0 and i % 2 != 0]

if len(N) % 2 != 0:
    total += int(N) - int(str(1) + (len(N) - 1) * "0") + 1

for digit in digits:
    total += int("9" * digit) - int("1" + "0" * (digit - 1)) + 1

print(total)

Submission status: Accepted

Solution code:
N = str(int(input()))
i = 1
total = 0
digits = [i for i in range(len(N)) if i != 0 and i % 2 != 0]

if len(N) % 2 != 0:
    total += int(N) - int(str(1) + (len(N) - 1) * "0") + 1

for digit in digits:
    total += int("9" * digit) - int("1" + "0" * (digit - 1)) + 1

print(total)

Submission status: Accepted

Solution code:
N = input()
i = 1
total = 0
digits = [i for i in range(len(N)) if i != 0 and i % 2 != 0]

if len(N) % 2 != 0:
    total = int(N) - int(str(1) + (len(N)-1)*"0") + 1
    for digit in digits:
        total += int("9"*digit) - int("1"+"0"*(digit-1)) + 1
elif len(N) % 2 == 0:
    for digit in digits:
        total += int("9"*digit) - int("1"+"0"*(digit-1)) + 1

print(total)

Submission status: Accepted

Solution code:
N = input()
i = 1
total = 0
digits = [i for i in range(len(N)) if i != 0 and i % 2 != 0]

if len(N) % 2 != 0:
    total = int(N) - int(str(1) + (len(N)-1)*"0") + 1
    for digit in digits:
        total += int("9"*digit) - int("1"+"0"*(digit-1)) + 1
else:
    for digit in digits:
        total += int("9"*digit) - int("1"+"0"*(digit-1)) + 1

print(total)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
    if len(str(i))%2==1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
for i in range(1, N + 1):
    digit = math.floor(math.log10(i)) + 1
    if digit % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0

for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(1, 6):
    # 10,1000,100000
    if i % 2 == 1:
        if n < 10 ** i:
            count += n - 10 ** (i-1) + 1
            print(count)
            exit()
        else:
            count += 10 ** i - (10**(i-1))

    else:
        if n < 10 ** i:
            print(count)
            exit()

print(count)

Submission status: Accepted

Solution code:
N = int(input())
keta = len(list(str(N)))
ans = 0

for i in range(keta):
    if i % 2 == 1:
        continue
    if i+1 != keta:
        ans += len(range(10**i, (10**(i+1))-1)) + 1
    else:
        ans += len(range(10**i, N)) + 1

print(ans)

Submission status: Accepted

Solution code:
#input 整数N
#output N以下の桁数が奇数である正の整数

# 1~9 : 9               #10~99 : 90
# 100~999 : 900         #1000~9999 : 9000
# 10000~99999 : 90000
# :
# :

N = int(input())
o = len(str(N))
i = 1
sum = 0

if o % 2 == 0:
    while 2*i-1 <= o:
        sum += 9 * 100 ** (i-1)
        i += 1
else:
    sum += N
    while 2*i <= o:
        sum -= 90 * 100 ** (i-1)
        i += 1 

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1):
  if len(str(i)) % 2 == 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1,N+1):
    if len(str(i)) %2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n= int(input())
ans = 0
for i in range(1, n+1 ):
	if len(str(i))%2 == 1:
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

c = 0
for i in range(1,N + 1):
    if len(str(i))%2 == 1:
        c += 1
print(c)

Submission status: Accepted

Solution code:
print(len([1 for i in range(1,int(input())+1) if len(str(i))%2 == 1]))

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
for x in range(1,N+1):
    if len(str(x))%2==1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
counter = 0
for i in range(1, n+1):
    s_n = str(i)
    if len(s_n) % 2 == 1:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
n = input()
cnt = 0 
for i in range(1,len(n)+1,2):
  if int(n) >= 10**i-1:
    cnt += 10**i-1-10**(i-1)+1
  else:
    cnt += int(n)-10**(i-1)+1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
if 1 <= n <= 9:
    print(n)
elif 10 <= n <= 99:
    print(9)
elif 100 <= n <= 999:
    print(n-90)
elif 1000 <= n <= 9999:
    print(909)
elif 10000 <= n <= 99999:
    print(n-9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import math

def main():
    n, = map(int, open(0).read().split())

    digit = math.floor(math.log10(n)) + 1

    ans = 0
    for i in range(1, digit + 1, 2):
        if i == digit:
            ans += n - 10**(i-1) + 1
        else:
            ans += 10**i - 10**(i-1)
    print(ans)
    return()

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
result = 0
for n in range(int(input())):
    result += len(str(n+1))%2
print(result)

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

N = int(input())

digit = len(str(N))

if digit == 1:
    ans = N
elif digit == 2:
    ans = 9
elif digit == 3:
    ans = N - 99 + 9
elif digit == 4:
    ans = 909
elif digit == 5:
    ans = N - 9999 + 900 + 9
elif digit == 6:
    ans = 90000 + 900 + 9

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
k = 0
for i in range(1, N+1):
    if 1 <= i <= 9:
        k += 1
    elif 100 <= i <= 999:
        k += 1
    elif 10000 <= i <= 99999:
        k += 1
print(k)

Submission status: Accepted

Solution code:
n = int(input())
count = 0

for i in range(1, n+1):
  if len(str(i)) % 2 == 1:
    count += 1
    
print(count)

Submission status: Accepted

Solution code:
N = list(input())
n = len(N)
N = int(''.join(N))

if(n == 1):
  ans = N
  print(ans)
elif(n == 2):
  print(9)
elif(n == 3):
  ans = N-100+1
  print(9+ans)
elif(n == 4):
  print(9+900)
elif(n == 5):
  ans = N-10000+1
  print(9+900+ans)
elif(n == 6):
  print(9+900+90000)

Submission status: Accepted

Solution code:
n = int(input())

a = str(n)
result = 0

if len(a) == 1:
    result += n
else:
    result += 9
    i = 3
    while i <= len(a)-1:
        result += 10**i - 10**(i-1)
        i += 2
    if len(a)%2 == 1:
        result += n - 10**(len(a)-1)+1
print(result)

Submission status: Accepted

Solution code:
s=input()
a=int(s)
b=0
if a<10:
  b=a
elif 10<=a<100:
  b=9
elif 100<=a<1000:
  b=a-90
elif 1000<=a<10000:
  b=909
elif 10000<=a<100000:
  b=a-9999+909
elif 100000<=a<1000000:
  b=90909
else:
  b=a-909090
print(b)

Submission status: Accepted

Solution code:
N = int(input())

a = []

for i in range(N+1):
	j = i
	a.append(j)

a.pop(0)

b = []
for i in a:
	i = str(i)
	b.append(i)

counter = 0


for i in b:
	if len(i)%2 !=0:
		counter+=1

print(counter)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    count = 0
    for n in range(1, N+1):
        if len(str(n)) % 2 == 1:
            count += 1
    print(count)

solve()

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(1, N+1):
  if len(str(i)) % 2 == 1:
    count += 1

print(count)

Submission status: Accepted

Solution code:
def p_b():
    n = int(input())

    a = list(map(int, list(str(n))))
    a.reverse()

    ans = 0

    for i in range(len(a)):
        if i % 2 == 1:
            continue

        if i == len(a) - 1:
            ans += n - 10 ** i + 1
        else:
            ans += 9 * 10 ** i

    print(ans)
    
p_b()

Submission status: Accepted

Solution code:
a = int(input())
if a<10:
    print(a)
elif a < 100:
    print(9)
elif a < 1000:
    print(9 + a - 99)
elif a < 10000:
    print(909)
elif a < 100000:
    print(909 + a - 9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int):
    k = len(str(N))

    result = 0
    for k_i in range(1, k, 2):
        result += 9 * 10 ** (k_i - 1)
    if k % 2 != 0:
        result += N - 10 ** (k - 1) + 1

    print(result)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
k=0
t=n

while t>0:
  t //= 10
  k += 1

s=0
if k%2:
  s = n+1-10**(k-1)
  k -= 1

while k>0:
  if k%2:
    s += 9 * 10**(k-1)
  k -= 1

print(s)

Submission status: Accepted

Solution code:
n = int(input())
cnt=0
for i in range(1,n+1):
   # print(i)
   i_str=str(i)
   if len(i_str) % 2 != 0:
      cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
count = 0
for i in range(1,n+1):
    if len(str(i))%2 == 1:
        count+=1

print(count)

Submission status: Accepted

Solution code:
import math
count = 0
sum = 0
N = int(input())
for i in range(N+1):
  while i != 0:
    i = math.floor(i/10)
    count +=1
  if count%2 == 1:
    sum +=1
    count = 0
print(sum)

Submission status: Accepted

Solution code:
N = int(input())
if N <10:
  print(N)
elif N >=10 and N<100:
  print(9)
elif N>=100 and N<1000:
  print(9+(N-99))
elif N >= 1000 and N<10000:
  print(9+900)
elif N >= 10000 and N<100000:
  print(9+900+(N-9999))
else:
  print(9+900+90000)

Submission status: Accepted

Solution code:
n=input()
l=len(n)
ans=0
if(l%2==0):
  for i in range(1,l,2):
    ans+=10**i-10**(i-1)
else:
  for i in range(1,l-1,2):
    ans+=10**i-10**(i-1)
  ans+=int(n)-(10**(l-1))+1
print(ans)

Submission status: Accepted

Solution code:
N = input()
m = len(N)
ans = 0
if m % 2 == 1:
  ans += int(N) - (10**(m-1)) + 1

for i in range(-(-m)//2):
  ans += 10**(2*i+1)-10**(2*i)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())

keta = len(str(N))

count = 0

if keta%2 == 1:
    if keta == 1:
        print(N)
    else:
        for i in range(keta):
            if i%2 == 0:
                continue
            else: 
                count += 10**i-10**(i-1)
        count +=N-10**(keta-1)+1
        print(count)
else:
    for i in range(keta):
        if i %2 ==0:
            continue
        else:
            count += 10**i-10**(i-1)
    print(count)

Submission status: Accepted

Solution code:
N = int(input())

res = 0
for i in range(1, N+1):
    if len(str(i))%2 == 1:
        res += 1
print(res)

Submission status: Accepted

Solution code:
n = int(input())

count = 0
count
for i in range(1,n+1):
    if (len(str(i)) % 2 != 0):
        count+=1

print(count)

Submission status: Accepted

Solution code:
n = int(input())

a = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    a += 1
    
print(a)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for n in range(N + 1):
    a = [int(b) for b in list(str(n))]
    if len(a) % 2 == 1:
        count += 1
print(count-1)

Submission status: Accepted

Solution code:
n=int(input())
if n<10:print(n)
elif n<100:print(9)
elif n<1000:print(n-90)
elif n<10000:print(909)
elif n<100000:print(n-9090)
else:print(90909)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
cnt =0
for i in range(1,1+n):
  if len(str(i)) % 2 == 1:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
count=0
for i in range(1,n+1):
	if len(str(i))%2==1:
			count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
answer = 0
for i in range(1, n + 1):
    if not len(str(i)) % 2 == 0:
        answer += 1
print(answer)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(1,N+1,1):
    if len(str(i)) %2 == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
x=0
for i in range(1,n+1,1):
  if int(len(str(i)))%2==1:
    x+=1
print(x)

Submission status: Accepted

Solution code:
n=int(input())
sum=0
for i in range(1, n+1):
   if len(str(i)) % 2 == 1:
      sum+=1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0
for i in range(1, n+1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
count = 0

for n in range(1, N+1):
    if len(str(n)) % 2 == 1:
        count += 1 

print(count)

Submission status: Accepted

Solution code:
N=int(input())

def ketasuu(N):
  N=str(N)
  return len(N)

ans=0
keta=ketasuu(N)

if keta%2==1:
  ans+=(N-10**(keta-1)+1)
  for i in range(0,keta-2,2):
    ans+=9*10**i
else:
  for i in range(0,keta-1,2):
    ans+=9*10**i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0

for i in range(1, n+1):
  a = len(str(i))
  if a%2 !=0:
    cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def main():
    n = int(input())

    if(n < 10):
        print(n)
    elif(10 <= n < 100):
        print(9)
    elif(100 <= n < 1000):
        print(9 + n - 99)
    elif(1000 <= n < 10000):
        print(999 - 99 + 9)
    elif(10000 <= n < 100000):
        print(9 - 99 + 999 - 9999 + n)
    else:
        print(9 - 99 + 999 - 9999 + 99999)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
res = 0

for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        res += 1

print(res)

Submission status: Accepted

Solution code:
import math
N = int(input())
ans=0
for i in range(N +1):
    if i>0 and math.ceil(math.log10(i+1))%2==1 :
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
cnt=0
for i in range(1,N+1):
  a = len(str(i))
  if a%2==1:
    cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n < 1000:
    print(9 + n - 99)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(909 + n - 9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
n  = int(input())

ans = 0

for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1, n+1):
  if len(str(i)) % 2 == 1:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
if 1<=n<=9:
    print(n)
elif 10<=n<=99:
    print(9)
elif 100<=n<=999:
    print(n-99+9)
elif 1000<=n<=9999:
    print(909)
elif 10000<=n<=99999:
    print(n-9999+909)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

print(sum(len(str(i)) % 2 == 1 for i in range(1, n + 1)))

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n < 1000:
    print(n - 90)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(n - 9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
import math

#整数 N が与えられます。
#N 以下の正の整数のうち、(先頭に 0 をつけずに十進法で表記したときの) 桁数が奇数であるようなものの個数を求めてください

#11 9
#136 46
#100000 90909

#N/10 + 1で桁数が求まる

N = int(input())
ans = 0

for i in range(1,N+1,1):
    #print(i,":",int(math.log10(i)))
    if (int(math.log10(i)) + 1)%2==1:
        ans = ans+1
        #print("add")
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0

for x in range(1, N+1):
    if(len(str(x)) % 2 == 1):
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

L = list(range(0,N+1))
cnt=0
for i in L[1:]:
  if len(str(i))%2==1:
    cnt+=1
    
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

res = 0
for i in range(1, n+1):
    if len(str(i))%2 == 1:
        res += 1

print(res)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for i in range (1,N+1):
    if len(str(i))%2==1:
      ans +=1
ans=int(ans)
print(ans)

Submission status: Accepted

Solution code:
# ABC136 B-Uneven Numbers
n = int(input())

ans = 0
for i in range(1,n+1):
    i = str(i)
    if len(i)%2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
    print(n)
elif 10<= n <100:
    print(9)
elif 100<= n <1000:
    print(n-90)
elif 1000<= n <10000:
    print(909)
elif 10000<= n <100000:
    print(n-9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

for i in range(1,7):
    if n%(10**i)==n:
        #print(i)
        break

if i ==1:
    ans = n
elif i ==2:
    ans = 9
elif i ==3:
    ans = 9+(n-99)
elif i ==4:
    ans = 909
elif i ==5:
    ans = 909+(n-9999)
elif i ==6:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
ans = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
if N<10:
  print(N)
elif 10<=N<100:
  print(9)
elif 100<=N<1000:
  print(N-90)
elif 1000<=N<10000:
  print(909)
elif 10000<=N<100000:
  print(N-9090)
else:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())
d = 0;aux = n
while(aux>0):
  aux//=10
  d+=1
ans = 0

if(d&1): ans+= n-10**(d-1)+1
if(d>1): ans+=9
if(d>3): ans+=999-100+1
if(d>5): ans+=99999-10000+1
print(ans)

Submission status: Accepted

Solution code:
num = list(range(1, (int(input())+1)))

count = 0
for i in num:
    if len(str(i)) % 2 == 1:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n=int(input())
if n==1000000:
  ans=90910
elif n>=100000:
  ans=90909
elif n>=10000:
  ans=909+(n-9999)
elif n>=1000:
  ans=909
elif n>=100:
  ans=9+(n-99)
elif n>=10:
  ans=9
else:
  ans=n
print(ans)

Submission status: Accepted

Solution code:
s = input()
n = int(s)
m = len(s)
ans = 0
i = 1
while(True):
    if i == m:
        ans += n - 10 ** (i - 1) + 1
        break
    elif i > m:
        break
    ans += 9 * 10 ** (i - 1)
    i += 2
print(ans)

Submission status: Accepted

Solution code:
s = input()
n = int(s)
m = len(s)
ans = 0
i = 1
while(True):
    if i == m:
        ans += n - 10 ** (i - 1) + 1
        break
    elif i > m:
        break
    ans += 10 ** i - 10 ** (i - 1)
    i += 2
print(ans)

Submission status: Accepted

Solution code:
num=int(input())
i=1
list=[]
for i in range(num):
    i+=1
    if len(str(i))%2==1:
        list.append(i)


print(len(list))

Submission status: Accepted

Solution code:
n=int(input())
count=0
if n>=10:
    count+=9
    if n>=1000:
        count+=900
        if n>=100000:
            count+=90000
        else:
            if n>=10000:
                count+=n-10000+1
    else:
        if n>=100:
            count+=n-100+1
    print(count)
else:
    print(n)

Submission status: Accepted

Solution code:
n=int(input())
n_str = str(n)
ans = 0

if len(n_str) == 1:
    print(n)
elif len(n_str) == 2:
    print(9)
elif len(n_str) == 3:
    print(9+n-99)
elif len(n_str) == 4:
    print(909)
elif len(n_str) == 5:
    print(9+900+n-9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
a = int(input())
geko = 0
for i in range(1,a+1) :
    if len(str(i)) % 2 == 1 :
        geko += 1

print(str(geko))

Submission status: Accepted

Solution code:
N = int(input());count = 0
for i in range(1,N+1):
    if len(str(i))%2==1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
#136 B
n=int(input())
if n<10:
    print(n)
elif n<100:
    print(9)
elif n<1000:
    print(9+n-99)
elif n<10000:
    print(909)
elif n<100000:
    print(909+n-9999)
elif n==100000:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
while n > 0:
    if len(str(n)) % 2 != 0:
        ans += 1
    n -= 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n <= 99:
  print(min(n,9))
elif n <= 9999:
  print(min(909, n - 90))
else :
  print(min(90909, n -9090))

Submission status: Accepted

Solution code:
N = int(input())

digits = [(N // (10 ** i) % 10) for i in range(6)]

for i in range(6):
    i_top = 5 - i
    if digits[i_top] > 0: break

ans = 0
for i in range(0, i_top):
    if i % 2 > 0: continue
    ans += (9 * (10 ** i))

if i_top % 2 == 0:
    ans += (N - (10 ** i_top) + 1)

print(ans)

Submission status: Accepted

Solution code:
x = input()
m = len(x)
x = int(x)

p = m//2
q = m%2

if q==1:
  if p==0:
    print(x)
    exit()
  else:
    a = 90
    while(p>0):
      x -= a
      a *= 100
      p -= 1
    print(x)
    exit()
else:
  if p==0:
    print(0)
    exit()
  else:
    x = 0
    a = 9
    while(p>0):
      x += a
      a *= 100
      p -= 1
    print(x)
    exit()

Submission status: Accepted

Solution code:
#a,b,c = map(int,input().split())
a=input()

ans = 0

for i in range(1,int(a)+1):
	#print(i)
	if len(str(i)) % 2 == 1:
		ans = ans + 1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0

for i in range(1, N+1):
    len_s = len(str(i))
    if len_s == 1 or len_s == 3 or len_s == 5:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))

if l==1:
  print(N)
elif l==2:
  print(9)
elif l==3:
  print(N-90)
elif l==4:
  print(909)
elif l==5:
  print(N-9090)
else:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())

digits_num = 0
q = 1
n = N

while q > 0:
    q = n // 10
    n = q
    digits_num += 1

one_digits = 9 - 1 + 1 
three_digits = 999 - 100 + 1
five_digits = 99999 - 10000 + 1

if digits_num == 6:
    print(one_digits + three_digits + five_digits)
elif digits_num == 5:
    print(one_digits + three_digits + (N - 10000 + 1))
elif digits_num == 4:
    print(one_digits + three_digits)
elif digits_num == 3:
    print(one_digits + (N - 100 + 1))
elif digits_num == 2:
    print(one_digits)
else:
    print(N - 1 + 1)

Submission status: Accepted

Solution code:
n=str(input())
s=int(n)
k=len(n)
ans=0
if k==1:
    ans=s
elif k==2:
    ans=9
elif k==3:
    ans=9+s-99
elif k==4:
    ans=909
elif k==5:
    ans=909+s-9999
elif k==6:
    ans=90909
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

print(n) if 1<=n<=9 else print(9) if 10<=n<=99 else print (n-90) if 100<=n<=999 else print(909) if 1000<=n<=9999 else print(n-9090) if 10000<=n<=99999 else print(90909)

Submission status: Accepted

Solution code:
n = int(input())
ans=0
for i in range (1,n+1):
	k= str(i)
	if len(k)%2==1:
			ans+=1

print(ans)

Submission status: Accepted

Solution code:
N = int (input())
if N < 10:
  print (N)
elif N >=10 and N <100:
  print ("9")
elif N >=100 and N < 1000:
  print (N - 99 + 9)
elif N >= 1000 and N < 10000:
  print ("909")
elif N >=10000 and N < 100000:
  print (N - 9999 + 900 + 9)
elif N == 100000:
  print ("90909")

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,1+n):
    if len(str(i))%2==1:ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
for i in range(1,N+1):
  if len(str(i))%2!=0:
    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
def ketasu(num):
    if num == 0:
        return 1
    else:
        ans = 0
        while num != 0:
            num = num // 10
            ans += 1
        return ans

n = int(input())
ans = 0
keta = ketasu(n)
for i in range(1, keta + 1):
    if i % 2 != 0:
        if i == keta:
            ans += n - 10 ** (i - 1) + 1
        else:
            ans += 10 ** i - 10 ** (i - 1)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
for i in range(1,N+1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
N = int(input())

total = 0
for x in range(1, N + 1):
    if len(str(x)) % 2 == 1:
        total += 1

print(total)

Submission status: Accepted

Solution code:
N=int(input())
count=0

for i in range(1,N+1):
  if len(str(i))%2 !=0:
  	count +=1

print(count)

Submission status: Accepted

Solution code:
n = int(input())

x = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        x += 1

print(x)

Submission status: Accepted

Solution code:
n = input()

counter = 0
for val in range(1,int(n)+1):
    if len(str(val))%2 != 0:
        counter +=1

print(counter)

Submission status: Accepted

Solution code:
n = int(input())
ans=0
for i in range(1,n+1):
    if len(str(i)) %2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
keta = len(str(n))
if keta==1 or keta==2:
  print(min(n, 9))
elif keta==3 or keta==4:
  print(min(n-90, 909))
elif keta==5 or keta==6:
  print(min(n-9090, 90909))

Submission status: Accepted

Solution code:
import math
n = int(input())
total = 0
word = str(n)
val1 = len(word)
ans = 0
if val1==1:
	ans = n
elif val1==2:
    ans = 9
elif val1==3:
	ans = 9+n-99
elif val1==4:
	ans = 909
elif val1==5:
	ans = 909+n-9999
else:
	ans = 90909
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1):
  if len(str(i))%2==1:ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
d = len(str(N))
ans = 0
if d == 1:
    ans = N
elif d == 2:
    ans = 9
elif d == 3:
    ans = 9 + N - 99
elif d == 4:
    ans = 9 + 999 - 99
elif d == 5:
    ans = 9 + 999 - 99 + N - 9999
else:
    ans = 9 + 999 - 99 + 99999 - 9999
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
length = len(str(N))
count = 0
for i in range(1,length,2):
    count += 9*(10**(i-1))

if length % 2 == 1:
    count += N+1-10**(length-1)

print(count)

Submission status: Accepted

Solution code:
N=int(input())

ans=0
for i in range(N,0,-1):
  test = str(i)
  L=len(test)
  if L%2==1:
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
count=0

for i in range(1,n+1):
    if len(str(i))%2==1:
        count+=1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
even = lambda x: len(list(str(x))) % 2 != 0
res = len(list(filter(even, range(1, n+1))))
print(res)

Submission status: Accepted

Solution code:
import math
n=int(input())
a=int(math.log10(n))
i=0
p=0
while i<a:
    if i%2==0:
        p+=9*10**i
    i+=1
if a%2==0:
    print(p+n-10**a+1)
else:
    print(p)

Submission status: Accepted

Solution code:
N = int(input())
N_list = list(range(1,N+1))
ans = 0

for i in range(N):
    if len(str(N_list[i])) % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

for i in range(1,N+1):
	if (len(str(i))) % 2 != 0:
		count += 1

print(count)

Submission status: Accepted

Solution code:
from sys import stdin

n = stdin.readline().rstrip()

count = 0
if (len(n)) % 2 == 1:
  count += int(n)-10**(len(n)-1)+1

for x in range(len(n)):
  if x % 2 == 1:
    count += 10**x - 10**(x-1)

print(count)