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

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

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)
elif n == 100000:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import heapq
from collections import Counter

#N,K=map(int, input[].split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
#x=list(map(int, input[].split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

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

if 8 >= N >= 1:
  print(N)
elif 99 >= N >= 9:
  print(9)
elif 999 >= N >= 100:
  print(N - 90)
elif 9999 >= N >= 1000:
  print(909)
elif 99999 >= N >= 10000:
  print(N - 9090)
elif N == 100000:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())
d = len(str(n))
ans = 0

if d == 1:
  print(n)
else:
  for i in range(1, d+1):
    if i % 2 == 0:
      continue

    if i == d:
      ans += n - (10**(i-1)) + 1
      break;

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

  print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

ans = 0

for i in range(1, N+1):
    if int(math.log10(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=len(str(i))
    if a%2 == 1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
m=str(n)
minus1=10**(len(m)-2)*9
minus=minus1
if len(m)==1:
    print(n)
elif len(m)%2==0:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1)
else:
    for i in range(len(m)//2):
        minus1+=minus//(100**(len(m)//2-i))
    print(minus1//10+n-10**(len(m)-1)+1)

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())
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(909)
elif n>=10000 and n<100000:
    print(909+n-9999)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()

num = int(n)

s = 0

for i in range(1,num+1):
	#print(i)
	if len(str(i))%2 == 1 :
		s = s + 1

print(s)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

if len(s) == 1:
    count = N
elif len(s) == 2:
    count = 9
elif len(s) == 3:
    count = N - 90
elif len(s) == 4:
    count = 909
elif len(s) == 5:
    count = N - 9090
elif len(s) == 6:
    count = 90909
print(count)

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

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

Submission status: Accepted

Solution code:
N = int(input())
sum = 0
for i in range(1, N + 1):
  if i < 10:
    sum += 1
  elif 99 < i < 1000:
    sum += 1
  elif 9999 < i < 100000:
    sum += 1
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

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):
  k = len(str(i))
  if k % 2 != 0:
    ans += 1
  else:
    pass

print(ans)

Submission status: Accepted

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

def main():
    N = int(input())
    count = 0
    for i in range(N):
        str_num = str(i+1)
        if len(str_num)%2 != 0:
            count += 1
    print(count)
    
    

if __name__ == "__main__":
    main()

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(9+900)
elif len(N)==5:
    print(9+900+int(N)-9999)
else:
    print(9+900+90000)

Submission status: Accepted

Solution code:
#再起関数で書いてみた
def count(n):
    #終了条件
    if n < 1:
        return 0
    
    #処理
    keta = len(str(n))-1
    if keta % 2 == 1:
        ans = 0
        n = 10**keta-1
    else:
        ans = n - 10**keta + 1
        n = 10**(keta-1)-1
    return ans + count(n)


n = int(input())
print(count(n))

Submission status: Accepted

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

Submission status: Accepted

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

for i in reversed(range(1, n+1)):
    if i // 10 == 0:
        count += 1
    elif i // (10 ** 2) >= 1 and i // (10 ** 2) <= 9:
        count += 1
    elif i // (10 ** 4) >= 1 and i // (10 ** 4) <= 9:
        count += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
i = 0
while 10**i <= n :
    if i % 2 == 1:
        ans += 9*10**(i-1)
    i += 1
if i % 2 == 1:
    ans += n-10**(i-1) + 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 math
n = int(input())
ans = 0
for i in range(1, n+1):
  if math.floor(math.log10(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 len(str(i))%2==1:
    cnt+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
'''
s = str(n)
o = s.count('1','3','5','7','9')
e = s.count('0','2','4','6','8')
print(o)
'''
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 == 1:
    count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
n=N
c=0
while n>0:
  n//=10
  c+=1

if c%2==0:
  print(int((10**c-1)/11))
else: 
  print(int(N-10**(c-1)+1+(10**(c-1)-1)/11))

Submission status: Accepted

Solution code:
def main(n):
    count = 0

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

    print(count)


if __name__ == "__main__":
    n = int(input())

    main(n)

Submission status: Accepted

Solution code:
n = int(input())

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

print(count)

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

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 = input()
a = 0
b = 2
if len(n) % 2 == 0:
  for x in range(len(n)//2):
    a += 9 * (10 ** (b - 2))
    b += 2
    
  print(a)

elif len(n) % 2 != 0:
  if len(n) == 1:
    print(n)
  else:
    for x in range(len(n)//2):
     a += 9 * (10 ** (b - 2))
     b += 2
    print(int(n) - 10**(len(n)-1) + a + 1)

Submission status: Accepted

Solution code:
n = int(input())

cnt = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
output = 0
for i, _ in enumerate(n[::-1]):
    # if len(n) == 1:
    #     output += int(n) + 1
    if i % 2 == 0:
        if i < len(n) - 1:
            output += 10 ** (i + 1) - 10 ** i
        else:
            output += int(n) - 10 ** i + 1

print(output)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
print(len(list(filter(lambda x: len(str(x)) % 2 == 1, range(1, N + 1)))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
if int(N) == 10**5:
    print(90909)
if len(N) == 5:
    print(int(N) - 9090)
if len(N) == 4:
    print(909)
if len(N) == 3:
    print(int(N) - 90)
if len(N) == 2:
    print(9)
if len(N) == 1:
    print(int(N))

Submission status: Accepted

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

count=0
for exp in range(0,length-1,2):
    count+=9*10**exp

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

print(count)

Submission status: Accepted

Solution code:
N = int(input())

import math
ans = 0
for i in range(1, N+1, 1):
    order = int(math.log10(i))+1
    if order%2 == 1:
        ans += 1
    else:
        continue

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())


res=0
for i in range(N):
        j=i+1
        if j < 10:
                res+=1
        elif j >= 100 and j < 1000:
                res+=1
        elif j >= 10000 and j < 100000:
                res+=1

print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
#一桁　９個
#三桁　９００個
#五桁　９００００個
N =int(input())
number =0
if N>=100000:
  number=90909
elif N>=10000:
  number=909+N-10000+1
elif N>=1000:
  number=909
elif N>=100:
  number=9+N-100+1
elif N>=10:
  number=9
else:
  number=N
print(number)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

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())
l = [len(str(x))%2 for x in range(1, n+1)]
print(sum(l))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc136/tasks/abc136_b
n = int(input())
if n <= 9 :
    print(n)
elif n <= 99:
    print(9)
elif n <= 999:
    print(9 - 99 + n)
elif n <= 9999:
    print(9 - 99 + 999)
elif n <= 99999:
    print(9 - 99 + 999 - 9999 + n )
else:
    print(9 - 99 + 999 - 9999 + 99999)

Submission status: Accepted

Solution code:
N = int(input())

if N ==100000:
    ans=90909
elif N > 9999:  
    ans=N-9999 +909
elif N > 999:
    ans=909
elif N > 99:
    ans=N-99 +9
elif N > 9:
    ans= 9
else :
    ans=N
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(9+N-100+1)
elif 1000<=N<=9999:
    print(909)
elif 10000<=N<=99999:
    print(909+N-10000+1)
else:
    print(909+90000)

Submission status: Accepted

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

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=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())
if n < 10:
  print(n)
  exit()
if n >= 10 and n < 100:
  print(9)
  exit()
if n >= 100 and n < 1000:
  #print(9 + (int(str(n)[-2:])) + 1)
  print(9 + (n-100) + 1)
  exit()
if n >= 1000 and n < 10000:
  print(909)
  exit()
if n >= 10000 and n < 100000:
  print(909 + (n-10000) + 1)
  exit
if n == 100000:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())

l = range(1, n+1)
a = [i for i in l if i < 10]
a += [i for i in l if 100 <= i < 1000]
a += [i for i in l if 10000 <= i < 100000]

ans = len(a)
print(ans)

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())
a = [i for i in range(1,10)]
b = [i for i in range(100,1000)]
c = [i for i in range(10000,100000)]
U1 = a+b+c
U2 =[i for i in range(1,N+1)]
print(len(set(U1) & set(U2)))

Submission status: Accepted

Solution code:
N = int(input())

i = 1
count = 0

while i <= N:
    if len(list(str(i))) % 2 != 0:
        count += 1
    i += 1

print(count)

Submission status: Accepted

Solution code:
N = int(input())
n = len(str(N))
if n == 1:
  print(N)
elif n == 2:
  print(9)
elif n == 3:
  print(N-90)
elif n == 4:
  print(909)
elif n == 5:
  print(N-9090)
else:
  print(90909)

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

answer = sum(len(str(x))&1 for x in range(1,N+1))
print(answer)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
n = len(str(N))
 
if n==1:
	print(N)
else:
	M = [9,0]*(n//2)			#list[9,0]がn//2個繋がっている
	M.pop()						#pop()でlistの最後尾を削除
	M = map(str,M)				#joinの際には文字列しか使えないのでstrを使用
	M = int(''.join(M))			#join(M)=90909みたいな。それを数字化
	if n%2==0:
		print(M)
	else:
		M = M + N - 10**(n-1) + 1
		print(M)

Submission status: Accepted

Solution code:
N = int(input())
n = len(str(N))
if n == 1:
    print(N)
else:
    M = [9,0] * (n//2)
    M.pop()
    M = map(str,M)
    M = int(''.join(M))
    if n % 2 == 0:
        print(M)
    else:
        M = M+N-10**(n-1)+1
        print(M)

Submission status: Accepted

Solution code:
N = int(input())
print(len(list(filter(lambda x : len(str(x))%2==1, range(1, N+1)))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())

counter=0
for i in range(1,N+1):

  if len(str(i))%2==1:
    counter=counter+1
print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if len(str(n)) == 1:
  print(n)
elif len(str(n)) == 2:
  print(9)
elif len(str(n)) == 3:
  print(9+(n-100+1))
elif len(str(n)) == 4:
  print(9+900)
elif len(str(n)) == 5:
  print(909+(n-10000+1))
elif len(str(n)) == 6:
  print(90909)

Submission status: Accepted

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

def main():
    N = int(input())
    i = 1
    ans = 0
    while 10**i <= N:
        ans += ((10**i) - (10**(i-1)))
        i += 2
    ans += max(0, N-10**(i-1)+1)
    print(ans)


if __name__ == "__main__":
    main()

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

length = len(str(n))

if length == 1:
    res = n
elif length == 2:
    res = 9
elif length == 3:
    res = 9 + n - 99
elif length == 4:
    res = 909

elif length == 5:
    res = 9 + 900 + n - 9999
else:
    res = 90909

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

Submission status: Accepted

Solution code:
n = int(input())
k2 = 9
k4 = len(range(100,1000))
k6 = len(range(10000,100000))
if len(str(n)) == 1:
  print(len(range(1,n+1)))
elif len(str(n)) == 2:
  print(k2)
elif len(str(n)) == 3:
  print(k2+len(range(100,n+1)))
elif len(str(n)) ==4:
  print(k2+k4)
elif len(str(n)) ==5:
  print(k2+k4+len(range(10000,n+1)))
elif len(str(n)) ==6:
  print(k2+k4+k6)

Submission status: Accepted

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

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

if l % 2 == 1:
    ans += n - 10 ** (l-1) + 1

print(ans)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    if 0 < n <= 9:
        print(n)
    elif 9 < n <= 99:
        print(9)
    elif 99 < n <= 999:
        print(n-90)
    elif 999 < n <= 9999:
        print(999-90)
    elif 9999 < n <= 99999:
        print(n-9999+999-90)
    else:
        print(90909)

if __name__ == '__main__':
    solve()

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

ans = 0

for n in range(N):
    if len(str(n+1)) % 2 == 1:
        ans += 1
    else:
        pass

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())
ans=0
for i in range(1,n+1):
    if 0<i<10:
        ans+=1
    elif 9<i<100:
        ans+=0
    elif 99<i<1000:
        ans+=1
    elif 999<i<10000:
        ans+=0
    elif 9999<i<100000:
        ans+=1
    else:
        ans+=0
print(ans)

Submission status: Accepted

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

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

ans = 0
for i in range(1, n + 1):
    cnt = 0
    while i > 0:
        i //= 10
        cnt += 1
    if cnt & 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = 0
for l in range(1,n+1):
    s = list(str(l))
    if len(s)%2 == 1:
        a += 1

print(a)

Submission status: Accepted

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

ans = 0
if l % 2:
    ans += n - 10 ** (l-1) + 1
    l -= 1

for i in range(l)[::2]:
    ans += 9 * 10 ** i

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

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

print(digit_odd)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
if n < 10:
    ans = n
elif n < 100:
    ans = 9
elif n < 1000:
    ans = n-90
elif n < 10000:
    ans = 909
elif n < 100000:
    ans = n-9090
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())
if n<10:
  print(n)
elif n<10**2:
  print(9)
elif n<10**3:
  print(n-(10**2-1)+9)
elif n<10**4:
  print(900+9)
elif n<10**5:
  print(n-(10**4-1)+900+9)
else:
  print(9*10**4+9*10**2+9)

Submission status: Accepted

Solution code:
N = int(input())

tmp = N
for i in range(1,8):
    tmp /= 10
    if tmp < 1:
        N_digit = i
        break

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

if N_digit%2 == 1:
    ans += len(range(10**(N_digit-1), N+1))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(oppai)

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=input()
d=len(n)
n=int(n)

#nの桁数はd
count=0
if d%2==1:
    count+=n-10**(d-1)+1
    for i in range((d-1)//2):
        count+=10**(2*i+1)-10**(2*i)
else:
    for i in range(d//2):
        count+=10**(2*i+1)-10**(2*i)
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
x, cnt = 0, 0
while 1:
    for i in range(100**x, 100**x*10):
        if(i > N):
            break
        else:
            cnt += 1
    if(i > N):
        break
    x += 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:
    count+=1
print(count)

Submission status: Accepted

Solution code:
import math

N = int(input())

dig = len(str(N))

dig_odd = math.floor(dig / 2)

A = 0

for i in range(dig_odd):
  A += 9 * 10 ** (2 * i)

if dig % 2 == 1 and dig_odd >= 1:
  A += N - (10 ** (dig - 1) - 1)
elif dig == 1:
  A = N
  
print(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
N=int(input())
ans=0
if N<=9:
  ans=N
elif 10<=N<=99:
  ans=9
elif 100<=N<=999:
  ans=9+(N-99)
elif 1000<=N<=9999:
  ans=909
elif 10000<=N<=99999:
  ans=909+(N-9999)
else:
  ans=90909
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in (1, 3, 5):
    if n / 10**i >= 1:
        ans += 10**i - 10**(i-1)
    elif n / 10**(i-1) >= 1:
        ans += n - 10**(i-1) + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    N = input()[:-1]
    
    cnt = 0
    for i in range(0, len(N), 2):
        if i==len(N)-1:
            cnt += int(N) - 10**i + 1
        else:
            cnt += 10**(i+1) - 10**i

    print(cnt)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    cnt = 0
    for i in range(1, n + 1):
        t = str(i)
        cnt += 1 if len(t) % 2 != 0 else 0
    print(cnt)


if __name__ == '__main__':
    slove()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

    return ans

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func(n):
    c=0
    k=n
    while(n):
        n//=10
        c+=1
    if c%2==1:
        return True
    else:
        return False
N=int(input())
ans=0
for i in range(N):
    if func(i+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 N in range(1,10):
  print(N)
elif N in range(10, 100):
  print(9)
elif N in range(100, 1000):
  print(9+(N-100+1))
elif N in range(1000, 10000):
  print(9+900)
elif N in range(10000, 100000):
  print(9+900+(N-10000+1))
elif N == 100000:
  print(9+900+90000)

Submission status: Accepted

Solution code:
N=input()
Num = len(N)
if Num == 5:
		Ans = (int(N)-9999) + 900 + 9
elif Num == 4:
		Ans = 900 + 9
elif Num == 3:
		Ans = (int(N)-99) + 9
elif Num == 2:
		Ans = 9
elif Num == 1:
		Ans = N
elif Num == 6:
  Ans = 90000 + 900 + 9
print(Ans)