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:
def main():
    # 入力
    n = int(input())
    cnt = 0
    for i in range(1, n+1):
        if len(str(i)) % 2 == 1:
            cnt += 1

    print(cnt)


main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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 - 100 + 1)
elif n >= 1000 and n < 10000:
  print(909)
elif n >= 10000 and n < 100000:
  print(909 + n - 10000 + 1)
elif n == 100000:
  print(909 + 99999 - 10000 + 1)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    length = len(str(n))

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

main()

Submission status: Accepted

Solution code:
N = input()
cnt = 0

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

Submission status: Accepted

Solution code:
N = input()

if int(N) < 9:
  print(N)
  
elif len(N) == 1 or len(N) == 2:
  print(9)

elif len(N) ==3:
  print(9+int(N)-99)
  
elif len(N) == 4:
  print(9 + 900)
  
elif len(N) == 5:
  print(9+900+int(N)-9999)
  
else:
  print(90909)

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
i = 0
for i in range(0, 5, 2):
  m = 10 ** i
  if len(str(m)) > len(str(N)):
    break
  M = int("9" * (i + 1))
  
  if M > N:
    M = N
  
  cnt += M - m + 1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

i = 1
cnt = 0

while i <= N:
  cnt += 1
  i += 1
  if len(str(i)) % 2 == 0:
    i *= 10
print(cnt)

Submission status: Accepted

Solution code:
N = input()
if(len(N)==1):#9
    print(N)
elif(len(N)==2):#99
    print(9)
elif(len(N)==3):#999
    print(int(N)-90)
elif(len(N)==4):#9999
    print(999-90)
elif(len(N)==5):#99999
    print(int(N)-9090)
else:
    print(90909)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.buffer.readline
N = int(input())
S = len(str(N))
cnt=0
for i in range(S,-1,-1):
    if i%2!=0:
        cnt=cnt+N-10**(i-1)+1
    else:
        N=10**(i-1)-1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = [0, 9, 909, 90909]
if len(str(n)) % 2 == 1:
    print(l[len(str(n)) // 2] + n - 10 ** (len(str(n)) - 1) + 1)
else:
    print(l[len(str(n)) // 2])

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-9091)
else:
  print(n-9090)

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
# map(int, input().split())
# int(input())
# input().split()
# mojiretu = ','.join(str_list)
# sorted(input())
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, n+1):
    if len(str(i)) % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

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




main()

Submission status: Accepted

Solution code:
# B - Uneven Numbers

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:
    ans += 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

digits = 0
tmp = n
while tmp:
  tmp //= 10
  digits += 1

ans = 0
for i in range(digits//2):
  ans *= 100
  ans += 9
if digits % 2:
  ans += n - 10**(digits-1) + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1,n+1):
    #print(i)
    s = str(i)
    keta = len(s)
    if keta %2 == 0:
        pass
    else:
        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())
ans = 0
for i in range(1,n+1):
    i=str(i)
    if len(i)%2!=0:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1, n+1):
    if i <= 9:
        cnt += 1
    elif 100 <= i and i < 1000:
        cnt += 1
    
    elif 10000 <= i and i < 100000:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n=input()
l=len(n)
m=int(n)
if l==1:
  a=m
elif l==2:
  a=9
elif l==3:
  a=9+(m-99)
elif l==4:
  a=9+900
elif l==5:
  a=9+900+(m-9999)
else:
  a=9+900+90000
print(a)

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N<=9:
  print(N)
elif N<=999:
  print(9+max(0,N-99))
elif N<= 99999:
  print(909+max(0,N-9999))
else:
  print(90909)

Submission status: Accepted

Solution code:
N=input()

if len(N)==1:
  print(int(N))
elif len(N)==2:
  print(9)
elif len(N)==3:
  print(9+int(N)-99)
elif len(N)==4:
  print(909)
elif len(N)==5:
  print(909+int(N)-9999)
elif len(N)==6:
  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:
        # print(i)
        ans += 1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import itertools
import numpy as np

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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_str = input()
n = int(n_str)

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1,keta)[::2]:

    l.append(9*(10**(i-1)))

if keta%2==1:
    l.append(N-(10**(keta-1))+1)

print(sum(l))

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1):
  keta = 0
  n = i
  for j in range(6):
    if n > 0:
      keta += 1
    n //= 10
  if keta % 2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC 136: B – Uneven Numbers
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(1, n+1):
    if len(str(i)) % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

i  = lambda: int(input())

N = i()

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))
if d==1:
    print(N)
elif d==2:
    print(9)
elif d==3:
    print(9+N-99)
elif d==4:
    print(909)
elif d==5:
    print(909+N-9999)
elif d==6:
    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())
a = [9,900,90000]
order = len(str(n))
if order == 1:
    print(n)
elif order == 2:
    print(9)
elif order == 3:
    print(n-100+1 + 9)
elif order == 4:
    print(909)
elif order == 5:
    print(n-10000+1 + 909)
else:
    print(90909)

Submission status: Accepted

Solution code:
n=int(input())

cnt=0

for i in range(1,n+1):
  k=1
  x=i
  while(1):
    if x<10:
      break
    else:
      x=int(x/10)
      k+=1
  if k%2==1:
    cnt+=1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = input()

ans = 0
i = 1

while 2*i - 1 < len(N):
  ans += 10**(2*i-1) - 10**(2*i-2)
  i += 1

if len(N)%2 == 0:
  print(ans)
else:
  print(ans + int(N) - 10**(len(N)-1) + 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input()) #文字列にするとlen()関数が使用可能
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 main():
    N = int(input())
    cnt = 0
    for i in range(1, N+1):
        if len(str(i)) % 2 == 1:
            cnt += 1
    print(cnt)
main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

""" Input
S = input().rstrip()
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""
N = int(input())

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

print(counter)



# def main():

# if __name__ == '__main__':
#     main()

Submission status: Accepted

Solution code:
def isOdd(x : int) -> bool:
    if len(str(x)) % 2 == 1:
        return True
    else: return False

def main(): 
    n = int(input())
    cnt = 0
    for i in range(1, n+1):
        if isOdd(i):
            cnt += 1
    print(cnt)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7


def main():
  N = int(input())
  ans = 0
  for i in range(1, N+1):
    if len(str(i))%2==1:
      ans += 1
  print(ans)
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
n = int(readline())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
def I(): return int(input())
N = I()
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, N + 1):
    if len(str(i)) % 2 != 0:
        count += 1

print(count)

Submission status: Accepted

Solution code:
n = input()
if (len(n) == 1):
    print(int(n))
elif (len(n) == 2):
    print(9)
elif (len(n) == 3):
    print(int(n)-99+9)
elif (len(n) == 4):
    print(909)
elif (len(n) == 5):
    print(909 + int(n) - 9999)
else:
    print(90909)

Submission status: Accepted

Solution code:
n = int(input())

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

print(x)

Submission status: Accepted

Solution code:
N = int(input())

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(N - 100 + 1 + 9)
elif N < 10000:
    print(909)
elif N < 100000:
    print(N - 10000 + 1 + 909)
elif N == 100000:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())
ans=0
for n in range(1,N+1):
    if len(str(n))%2!=0:
        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 != 0:
    count += 1
print(count)

Submission status: Accepted

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

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
    ans+=n-99
elif(n<10000):
    ans+=9
    ans+=900
elif(n<100000):
    ans+=9
    ans+=900
    ans+=n-9999
else:
    ans+=9
    ans+=900
    ans+=90000
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
cnt=0
for i in range(N):
    k=str(N-i)
    if len(k)%2==1:
        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())
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())

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

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:
c = 0
N = int(input())
for i in range(1,N+1):
  if i < 10 or (100 <= i and i <= 999) or (10000 <= i and i <= 99999):
    c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
import math
digit = int(math.log10(n))+1
ans = 0
if digit%2==0:
  for i in range(digit-1,0,-1):
    if i%2!=0: ans += (10**i-10**(i-1))
  print(ans)
else:
  ans = n-10**(digit-1)+1
  for i in range(digit-2,0,-1):
    if i%2!=0: ans += (10**i-10**(i-1))
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def digit(n):
    """桁数
    """
    return len(list(map(int, str(n))))

N = int(input())
ans = 0
for i in range(1, N+1):
    if digit(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:
n=int(input())
a=0
for i in range(1,n+1):
    a+=len(str(i))%2
print(a)

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
    else:
        continue
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(1,n+1):
  s = str(i)
  if len(s) % 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:
def resolve():
    import math
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        test = len(str(i))
        if test % 2 == 1:
            ans += 1
    print(ans)
resolve()

Submission status: Accepted

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

for i in range(1, N + 1):
    l = len(str(i))
    if l % 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 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

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

ans = 0
if m > 1:
    for i in range(0, m - 1, 2):
        ans += 9 * (10 ** i)

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

print(ans)

Submission status: Accepted

Solution code:
#B
n = int(input())
s = str(n)
l = len(s)

cnt = 0

for i in range(1,l+1):
    s = str(n)
    l = len(s)
    if i % 2 == 1:
        if n < 10:
            cnt += n
            break
        elif i == 1:
            cnt += 9
            
        elif n < 10**i:
            cnt += n - 10**(i-1) + 1
            
            
        else:
            cnt += 10**(i) - 10**(i-1)
print(cnt)

Submission status: Accepted

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

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())
c = 0

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

Submission status: Accepted

Solution code:
num = int(input())
lst = []
count = 0
for i in range(1, num+1):
  while i > 0:
    lst.append(i%10)
    i //= 10
  if len(lst) % 2 == 1:
    count += 1
  lst = []
print(count)

Submission status: Accepted

Solution code:
n = int(input())

if (n >= 1) and (n <= 8):
    print(n)
elif (n >= 9) and (n <= 99):
    print(9)
elif (n >= 100) and (n <= 998):
    print(n - 90)
elif (n >= 999) and (n <= 9999):
    print(909)
elif (n >= 10000) and (n <= 99998):
    print(n - 9090)
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 != 0:
        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())

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

Submission status: Accepted

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

print(counter)

Submission status: Accepted

Solution code:
n = input()
keta = len(n)
n = int(n)

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

if keta % 2 == 0:
	print(ans)
else:
	ans += n - 10**(keta-1) + 1
	print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
s = int(n)
l = len(n)
if l == 1:
    print(s)
if l == 2:
    print(9)
if l == 3:
    print(9+s-99)
if l == 4:
    print(909)
if l == 5:
    print(9+900+s-9999)
if l == 6:
    print(90909)

Submission status: Accepted

Solution code:
N=int(input())
ans = 0
for i in range(1,10):
  if i<=N:
    ans = ans + 1
for i in range(100,1000):
  if i<=N:
    ans = ans + 1
for i in range(10000,100000):
  if i<=N:
    ans = ans + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

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,1):
    if len(str(i))%2!=0:
        cnt+=1
    else:
        continue
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def digits(n):
  return int(math.log10(n))+1
  
def main():
  n = int(input())
  n_digit = digits(n)
  ans = 0
  
  if n_digit%2==0:
    for i in range(n_digit-1,0,-2):
      ans = ans + (pow(10,i)-pow(10,i-1))  
  else:
    ans = n - pow(10,n_digit-1) + 1
    for i in range(n_digit-2,0,-2):
      ans = ans + (pow(10,i)-pow(10,i-1)) 
  print(ans)
    
  
if __name__ == "__main__":
  main()

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())
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([len(str(i))%2 for i in range(1,int(input())+1)]))

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
c=0
for i in range(1,N+1):
    if(0<i<10 or 99<i<10**3 or (10**4-1)<i<10**5):c+=1

print(c)

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
for i in range(1, N+1):
    if int(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:
s = int(input())
ans = 0

for i in range(1, s + 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=input()
x=0
for i in range(int(n)):
    if len(str(i+1))%2!=0:
        x+=1
print(x)

Submission status: Accepted

Solution code:
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())
digit = len(str(n))

cnt = 0
for i in range(1, digit):
    if i % 2 == 1:
        cnt += 10**i - 10**(i - 1)

if digit % 2 == 1:
    cnt += n - 10**(digit - 1) + 1
    
print(cnt)

Submission status: Accepted

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