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())
#A=list(map(int,input().split()))
#b=list(map(int,input().split()))
#s=[input() for _ in range(n)]
ans=0
for i in range(1,n+1):
        if len(str(i))%2==1:
                ans+=1
print(ans)

Submission status: Accepted

Solution code:
def solve(string):
    base = int(string) if len(string) % 2 else 10**(len(string) - 1) - 1
    excepts = sum([9 * 10**(i - 1) for i in range(2, len(string), 2)])
    return str(base - excepts)


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

Solution code:
N = input()
ans = 0
if len(N) % 2 == 0:
    a = len(N) - 1
    for i in range(1, a+1, 2):
        ans += 9*(10**(i-1))
else:
    a = len(N) - 2
    for i in range(1, a+1, 2):
        ans += 9*(10**(i-1))
    ans += int(N) - 10**(len(N)-1) + 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=count+1
print(count)

Submission status: Accepted

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

for i in range(1,n+1):
    if (i >=1 and i <=9) or (i >= 100 and i <= 999) or (i >= 10000 and i <= 99999):
        ans += 1
print(ans)

Submission status: Accepted

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

for num in range(1, n+1, 1) : 
    if len(str(num)) % 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 != 0:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

Solution code:
n = input()
i = int(n)
cnt = 0
ans = 0
while i >= 1:
  i = int(i) / 10
  cnt = int(cnt) + 1
if int(cnt) % 2 == 0:
  i = cnt / 2
  if i == 3:
      ans = 90000 + 900 + 9
  elif i == 2:
      ans = 900 + 9
  else :
      ans = 9
else :
  i = (int(cnt) / 2) + 1
  if i >= 3:
    ans = 9 + 900 + (int(n) - 10000) + 1
  elif i >= 2:
    ans = 9 + (int(n) - 100) + 1
  else :
    ans = int(n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

digit = 0;
tmp = N
while tmp > 0:
    tmp //= 10
    digit += 1

ans = 0
for i in range(1, digit, 2):
    ans += pow(10, i) - pow(10, i-1)
if digit%2 == 1:
    ans += N - pow(10, digit-1) + 1 

print(ans)

Submission status: Accepted

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

if dig%2==1:
    ans=n+1-10**(dig-1)
    dig-=2
    while dig>2:
        ans+=9*10**(dig-1)
        dig-=2 
else:
    dig-=1
    while dig>2: 
        ans+=9*10**(dig-1)
        dig-=2

if n>9:
    ans+=9

print(ans)

Submission status: Accepted

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

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 = input()
l = []
for i in range(1,int(n)+1):
  if len(str(i))%2 != 0:
    l.append(i)

print(len(l))

Submission status: Accepted

Solution code:
a = int(input())
b = []

for i in range(1,a+1):
  i = str(i)
  if len(i) % 2 == 1:
    b.append(int(i))
print(len(b))

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
for i in range(1,N+1):
    if 0<=i<10 or 100<=i<1000 or 10000<=i<100000:
        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 != 0:
        ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(n)

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())
ans = 0
for i in range(n):
    if 0<i+1<10 or 99<i+1<1000 or 9999<i+1<100000:
        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:
count = 0
for i in range(1, int(input())+1):
    if len(list(str(i))) % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 numpy as np
N=int(input())
#N以下の正の整数の文字列を生成



list_a=np.arange(1, N+1)
list_b =[]


#print(list_a)
#print(len(str(list_a)))

for i in list_a:
    if  len(str(i))%2 !=0:
        #print(i)
        list_b.append(i)

print(len(list_b))

Submission status: Accepted

Solution code:
n = input()
cnt = 0

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

Submission status: Accepted

Solution code:
N = int(input())
counter=0
for num in range(1,N+1):
  if len(str(num))%2 == 0:
    pass
  else:
    counter+=1
print(counter)

Submission status: Accepted

Solution code:
# coding: utf-8
N = input()
length = len(N)
ans = 0
if length == 1:
    ans = int(N)
elif length == 2:
    ans = 9
elif length == 3:
    ans = 9 + int(N) - 99
elif length == 4:
    ans = 909
elif length == 5:
    ans = 909 + int(N) - 9999
elif length == 6:
    ans = 90909
print(ans)

Submission status: Accepted

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

#Nが1桁の場合
if(N<10):
    print(N)
    sys.exit()
#Nが2桁の場合
if(N<100):
    print(9)
    sys.exit()
#Nが3桁の場合
if(N<1000):
    print(N-90)
    sys.exit()
#Nが4桁の場合
if(N<10000):
    print(909)
    sys.exit()
#Nが5桁の場合
if(N<100000):
    print(N-9090)
    sys.exit()
#N=10^5の時
if(N==100000):
    print(90909)
    sys,exit()

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:
import sys
input = sys.stdin.readline

n = int(input())
ans = 0
for i in range(1, n + 1):
	x = str(i)
	if len(x) & 1:
		ans += 1
print(ans)

Submission status: Accepted

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



if __name__ == "__main__":
    test()

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 i in range(n + 1):
  if i == 0:
    pass
  elif int(len(str(i))) % 2 != 0:
    count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

const10000 = 90000
const100   = 900
const1     = 9

if 100000 == N:
    print(90909)
elif 10000 <= N:
    div10000, mod10000 = divmod(N,10000)
    res = const100 + const1 + (div10000-1)*10000 + mod10000 + 1
    print(res)
elif 1000 <= N:
    print(909)
elif 100 <= N:
    div100, mod100 = divmod(N,100)
    res = const1 + (min(10,div100)-1)*100 + mod100 + 1
    print(res)
elif 10 <= N:
    print(const1)
else:
    print(N)

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:
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())
number = len(str(N))
count = 0

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
if n <= 99:
  print(min(9, n))
elif n <= 9999:
  print(min(999, n)-90)
elif n <= 999999:
  print(min(99999, n)-9090)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

X = 0
for i in range(N + 1):
    if 0 < i and i < 10 or 100 <= i and i < 1000 or 10000 <= i and i < 100000:
        X += 1
    else:
        X += 0
print(X)

Submission status: Accepted

Solution code:
from math import log10


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

    index = int(log10(N))

    count = 0
    for i in range(1, index + 1, 2):
        count += 10**i - 10**(i - 1)

    if index % 2 == 0:
        count += N - 10**index + 1

    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(T)

Submission status: Accepted

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

print (count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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()
N=N.split()
N=int(N[0])

if 1<=N and N<=9:
    output=N
elif 10<=N and N<=99:
    output=9
elif 100<=N and N<=999:
    output=N-99+9
elif 1000<=N and N<=9999:
    output=900+9
elif 10000<=N and N<=99999:
    output=N-9999+900+9
else:
    output=90000+900+9
print(output)

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 - 90 - 9000)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

length = len(str(n))

temp = 10
ans = 0
for i in range(length-1):
    if i%2 == 0:
        ans += temp * 0.9
    temp *= 10

if length%2 == 1:
    ans += n - temp/10 + 1
print(int(ans))

Submission status: Accepted

Solution code:
import numpy as np

N=int(input())

counter=0
for i in range(1, N+1):
  if int(np.log10(i))%2==0:
    counter+=1
    
print(counter)

Submission status: Accepted

Solution code:
N=int(input())
count=0
for i in range(1,N+1):
  ks=len(str(i))
  if ks!=2 and ks!=4 and ks!=6:
    count=count+1
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c = 0
n = int(input())
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())
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())

length = int(math.log10(N))+1
sum_num=0

for i in range(length):
    if (i+1)%2!=0:
        if (i+1) != length:
            sum_num += 10**(i)*9
        else:
            sum_num += N-10**i+1
print(sum_num)

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:
print(sum(1 for i in range(1, int(input().strip())+1) if len(str(i))%2 == 1))

Submission status: Accepted

Solution code:
N=int(input())
#another way:
def count_digits(n):
    d=0
    while(n>0):
        d += 1
        n = n//10
    return d
c=0
for i in range(1,N+1):
    if (count_digits(i)%2==1):
        c += 1
print(c)

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:
import sys
input = sys.stdin.readline

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
ans+=min(9,N)
if N>99:ans+=min(900,N-99)
if N>9999:ans+=min(90000,N-9999)
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
ans = 0
if N >= 10 ** 5:
    N = 10 ** 5 - 1
if N >= 10 ** 4:
    ans += N - 10 ** 4 + 1
if N >= 10 ** 3:
    N = 10 ** 3 - 1
if N >= 10 ** 2:
    ans += N - 10 ** 2 + 1
if N >= 10 ** 1:
    N = 10 ** 1 - 1
if N >= 10 ** 0:
    ans += N
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:
a = int(input())

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

N = int(input())
digit = len(str(N))
# 1-99
if digit < 3:
    print(min((N), 9))
# 100-999
elif digit == 3:
    print(N-99+9)
# 1000-9999
elif digit == 4:
    print(999-99+9)
# 10000-99999
elif digit == 5:
    print(N-9999-99+999+9)
# 100000
else:
    print(99999-9999-99+999+9)

Submission status: Accepted

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

if N < 10:
  ans = N
elif N < 100:
  ans = 9
elif N < 1000:
  ans = 9 + N - 99
elif N < 10000:
  ans = 9 + 900
elif N < 100000:
  ans = 9 + 900 + N - 9999 #1-9, 100-999, 10000-99999
else:
  ans = 9 + 900 + 90000
print(ans)

Submission status: Accepted

Solution code:
#B - Uneven Numbers(ABC136)
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:
#coding:utf-8
n = int(input())
num = []

#文字扱いにして桁数をカウントする
for i in range(1, n+1):
    num.append(str(i))

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

print(count)

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 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(909+(n-9999))
else:
    print(90909)

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())
count = 0
for i in range(N + 1):
  if len(list(str(i))) % 2 == 1:
    count += 1
print(count - 1)

Submission status: Accepted

Solution code:
#ACB-136-B1

N = int(input())

str_N= str(N)
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,n+1):
  if len(str(i)) % 2 == 1:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
"""
for line in sys.stdin:
    A, B, C = map(int, line.split())
"""
for line in sys.stdin:
    N = int(line)

cnt = 0
for n in range(1,N+1):
  n = str(n)
  if len(n) % 2 != 0:
    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!=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())
cnt=0
for i in range(1,n+1):
  for j in range(6):
    if 10**j<=i<10**(j+1):
      J=j
      break
  if J%2==0:
    cnt+=1
print(cnt)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

while N > 0:
  s = str(N)
  length = len(s)
  if length % 2 == 0:
    N -= 1
  else:
    cnt += 1
    N -= 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())
count=0
for n in range(1,N+1):
    if 0<n<10:
        count+=1
        continue
    elif 99<n<1000:
        count+=1
        continue
    elif 9999<n<100000:
        count+=1
        continue
    else:
        pass
print(count)

Submission status: Accepted

Solution code:
n = int(input())
def check_10(num, count):
    if num < 10:
        return count
    num /= 10
    count += 1
    return check_10(num, count)
c = 0
counter = check_10(n, c)
result = 0
if counter%2 == 0:
    for i in range(int(counter//2)):
        result += 10**(2*i+1) - 10**(2*i)
    result += n - 10**counter + 1
elif counter >= 2:
    for i in range(int(counter//2)+1):
        result += 10**(2*i+1) - 10**(2*i)
elif counter == 1:
    result += 9
else:
    result += n
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A=input()
n=len(A)
ans=0
if n == 1:
  ans=int(A)
elif n == 2:
  ans=9
elif n == 3:
  ans=int(A)-90
elif n == 4:
  ans=909
elif n == 5:
  ans=int(A)-9090
else:
  ans = 90909
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:
N = int(raw_input())

d_num = 0
even = True
ary = []
N_tmp = N

while N_tmp != 0:
    ary.append(N_tmp % 10)
    N_tmp = N_tmp / 10
    even = not even
    d_num = d_num + 1

# print d_num, ary

if d_num == 1:
    print ary[0]
elif d_num == 2:
    print 9
elif d_num == 3:
    print 9 + (N -100) +1
elif d_num == 4:
    print 9 + 900
elif d_num == 5:
    print 9 + 900 + (N -10000) +1
elif d_num == 6:
    print 9 +  900 + 90000

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

# 1
a1 = 10 - 1 # o
# 2
a2 = 100 - 10 # e

a3 = 1000 - 100 # o
# 3
a4 = 10000 - 1000 # e

# 4
a5 = 100000 - 10000 # o

if N // 10**5 > 0:
  print(a1+a3+a5)
elif N // 10**4 > 0:
  print(N - 10**4+1+a1 + a3)
elif N // 10**3 > 0:
  print(a3+a1)
elif N // 10**2 > 0:
  print(N - 10**2+ 1  + a1)
elif N // 10 > 0:
  print(a1)
else:
  print(N)

Submission status: Accepted

Solution code:
N = int(input())
f = len(str(N))
if f%2 == 0:
  print((100**(f//2)-1)//11)
else:
  print((100**((f-1)//2)-1)//11 + N - 10**(f-1) + 1)

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
count = 0
for i in range(n):
    if len(list(str(i+1)))%2 != 0:
        count += 1
print(count)

Submission status: Accepted

Solution code:
print(sum(len(str(i+1))%2for i in range(int(input()))))

Submission status: Accepted

Solution code:
import math

s = input().split()
n=int(s[0])
x = int(math.log(n, 10))
count=0
for i in range(x):
        if i%2==0:
                count=count+9*10**i
if x % 2 == 0:
                count = count+n-10**x+1

print(count)

Submission status: Accepted

Solution code:
n = input()

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

print(c)

Submission status: Accepted

Solution code:
N = int(input())
uneven = [9, 0, 900, 0, 90000]
digits = len(str(N))

if digits == 1:
    print(N)
elif (digits % 2) == 0:
    print(sum(uneven[0:digits]))
else:
    print(N - 10**(digits-1) + 1 + sum(uneven[0:digits-1]))

Submission status: Accepted

Solution code:
n=input()
L=len(n)
N=int(n)
if L==1:
    print(N)
elif L==2:
    print(9)
elif L==3:
    print(9+N-100+1)
elif L==4:
    print(9+900)
elif L==5:
    print(9+900+N-10000+1)
else:
    print(9+900+90000)

Submission status: Accepted

Solution code:
import math
n=int(input())
m=int(math.log10(n)+1)
ans=0
def count(x):
  global ans
  if x>0:
    ans+=10**(x)-10**(x-1)
    count(x-2)
  else:
    return ans
if m%2==0:
  count(m-1)
else:
  count(m-2)
  ans+=n-10**(m-1)+1
print(ans)

Submission status: Accepted

Solution code:
# stdin
INPUT_SENTENCES = 1
N = int([input() for i in range(INPUT_SENTENCES)][0])
result = 0
for i in range(1, N+1):
    if len(str(i)) % 2 == 1:
        result += 1
print(result)

Submission status: Accepted

Solution code:
def is_odd_digit(x):
	i = 0
	while x != 0:
		x //= 10
		i += 1
	return i % 2 != 0

def main():
	n = int(input())
	
	ans = 0
	for i in range(1, n + 1):
		if is_odd_digit(i):
			ans += 1
	
	print(ans)

main()

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(1)][0]
r = 0

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

Submission status: Accepted

Solution code:
# Standard module
import math

# 3rd party's module

# Original module  

class CalcVal():
    def set_num(self, num):
        self._num = num
        self._calc_ord()
        
    def get_sum_pow(self):
        max_rng = math.ceil(self._ord/2.)
        sum_data = 0
        for i in range(max_rng):
            sum_data += 9*10**(i*2)
        return sum_data
    
    def get_remain_cal(self):
        self._ord = math.floor(math.log10(self._num))
        if self._ord == 0:
            #DO NOT count 0
            return self._num
        else:
            return self._num - 10**self._ord + 1
        
    def do(self):
        sum_data = self.get_sum_pow()
        if self._ord%2 == 0:
            sum_data += self.get_remain_cal()
        return sum_data
        
    
    def _calc_ord(self):
        self._ord = math.floor(math.log10(self._num))


def main_func():
    cv = CalcVal()
    cv.set_num(int(input()))
    print(cv.do())
        

main_func()

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 n<10:
  print(n)
  exit()
if 10<=n<100:
  print(9)
  exit()
if 100<=n<1000:
  print(9+n-99)
if 1000<=n<10000:
  print(909)
if 10000<=n<100000:
  print(n-9999+909)
if n==100000:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())
count = 0
keta_list = [9, 0, 900, 0, 90000, 0]
genkai_list = [9, 0, 999, 0, 99999, 0]
keta = len(str(N))
for target_list in range(keta):
    if N > genkai_list[target_list]:
        count = count + keta_list[target_list]
    else: 
        count = count + N - 10 ** (target_list)+1
print(count)

Submission status: Accepted

Solution code:
n = int(input())

print(len([x for x in list(range(1,n+1)) if len(str(x)) & 1 == 1]))

Submission status: Accepted

Solution code:
N = int(input())
count=0
for i in [0,2,4]:
  if N < 10**i:
    break
  for j in range(10**i, min(10**(i+1), N+1)):
    count+=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
for i in range(6):
  if 10**i<=N and N<10**(i+1):
    n = i+1 #桁数
    
ans = 0
if n%2==0:
  for i in range(1,n):
    if i%2!=0:
      ans += 10**i-10**(i-1)
else:
  for i in range(1,n+1):
    if i%2!=0 and i!=n:
      ans += 10**i-10**(i-1)
    elif i==n:
      ans += N - 10**(n-1)+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1, n + 1):
    t = str(i)
    cnt += 1 if len(t) % 2 != 0 else 0
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(9+N-100+1)
elif 1000<=N<=9999:
  print(909)
elif 10000<=N<=99999:
  print(909+N-10000+1)
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:
num = int(input())
#print(num)
cnt=0
for i in range(1,num+1):
  #print(i)
  if len(str(i))%2==1:
    cnt = cnt+1
    
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

def getNumOfDigits(num: int):
    count = 1
    while True:
        count += 1
        num /= 10
        if num < 10:
            break
    return count

def solve(N: int):
    num = getNumOfDigits(N)
    if num in {1,2}:
        print(min(N,9))
    elif num in {3,4}:
        print(9 + min(N -100 + 1, 900))
    elif num in {5,6}:
        print(909 + min(N - 10000 + 1, 90000))
    else :
        print('none')
    
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys

N = int(sys.stdin.read().strip())
total = 0
for v in range(6):
  if v % 2 != 0:
    continue
  low = 10 ** v
  high = 10 ** (v+1)
  if N < low:
    break
  if N >= high:
    total += high - low
  else:
    total += N - low + 1
    break
print(total)

Submission status: Accepted

Solution code:
N=int(input())
S=0
for x in range(1,N+1):
    i=0
    j=0
    XX=x
    while i==0:
        XX=XX//10
        if XX==0:
            i=1
        j=j+1
    if j%2==1:
        S=S+1
print(S)

Submission status: Accepted

Solution code:
n = int(input())

i = 0
answer = 0
while n >= 10 ** (2*i + 1):
  answer += 10 ** (2*i + 1) - 10 ** (2*i)
  i += 1
answer += max(0, n - 10 ** (2*i) + 1)

print(answer)

Submission status: Accepted

Solution code:
N = input()
l = (len(N) + 1) // 2
isodd = len(N) % 2
cnt = 0
for ii in range(1, l + 1):
    k = ii * 2 - 1
    if ii == l and isodd:
        cnt += int(N) - 10 ** (k - 1) + 1
    else:
        cnt += 10 ** k - 10 ** (k - 1)

print (cnt)

Submission status: Accepted

Solution code:
a = int(input())
l = len(str(a))
s = l//2
t = 0
x = 0
if l%2 == 1:
    for i in range(s):
        t += 9*10**(2*i+1)
    x =a-t
else:
    for i in range(s-1):
        t += 9*10**(2*i+1)
    x = 10**(l-1)-1-t
print(x)

Submission status: Accepted

Solution code:
n=int(input())

i=1
cnt = 0 
while(i<=n):
	if i < 10 or (i >= 100 and i < 1000) or (i>=10000 and i<100000) :
		cnt+=1
		i+=1
	elif n == 100000:
		cnt  = 90909
		break
	elif len(str(i)) > 1:
		if i < 100:
			i = 100

		elif i >999 and i< 10000:
			i = 10000
	
print(cnt)

Submission status: Accepted

Solution code:
#Coding:Utf-8

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

Submission status: Accepted

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

for i in range(1, N+1):
	num = i
	digit = 0
	while num > 0:
		num //= 10
		digit += 1

	if digit % 2 == 1:
		count += 1

print (count)

Submission status: Accepted

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

n = int(input())

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

print(counter)

Submission status: Accepted

Solution code:
def B_UnevenNumbers():
    N = int(input())
    num = 0
    for x in range(1,N+1):
        if len(str(x)) % 2:
            num += 1
    print(num)
    
if __name__ == "__main__":
    B_UnevenNumbers()

Submission status: Accepted

Solution code:

import bisect
import collections
import itertools


def getint(): return int(input())
def getints(): return list(map(int, input().split()))
def getint2d(rows): return [getints() for _ in range(rows)]
def getgrid(rows): return [input() for _ in range(rows)]
def array1d(n, value): return [value for _ in range(n)]
def array2d(n, m, value): return [array1d(m, value) for _ in range(n)]

n=getint()

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
digit = len(str(n))

ans = 0

if digit == 1:
    ans = n
elif digit == 2:
    ans = 9
elif digit == 3:
    ans = 9 + (n - 99)
elif digit == 4:
    ans = 9 + 900
elif digit == 5:
    ans = 9 + 900 + (n - 9999)
elif digit == 6:
    ans = 9 + 900 + 90000
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

result = []
for i in range(1,n+1):
    if len(str(i)) % 2 != 0:
        result.append(i)
        
print(len(result))

Submission status: Accepted

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

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()

zero = "0"
nine = "9"
zeronine = ""

for index in range(len(n)-1):
  if index%2==1:
    zeronine += zero
  else:
    zeronine += nine

if len(n)%2==0:
  print(int(zeronine))
else:
  if len(n)==1:
    print(int(n))
  else:
    print(int(n)-int(zeronine))

Submission status: Accepted

Solution code:
n=int(input())
ans=0
for i in range(1,n+1):
    k=1
    while i>=10**k:
        k+=1
    if k%2==1:
        ans+=1
print(ans)