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

Submission status: Accepted

Solution code:
import math

N = int(input())
k = int(math.log10(N))
s = 0
for i in range(1, k + 1):
    if i % 2 == 0:
        continue
    s += 10 ** i - 10 ** (i - 1)
if k % 2 == 0:
    s += N - 10**k + 1
print(s)

Submission status: Accepted

Solution code:
N = int(input())

c = 0
while N>0:
    if N<10 or (N>99 and N<1000) or (N>9999 and N<100000):
        c = c + 1
    N = N - 1

print(c)

Submission status: Accepted

Solution code:
N = input()
l = len(N)
# print(len(N))


ans = 0

if l % 2 == 0:  # 偶数

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

else:
    for i in range(1, l, 2):
        ans += 9*(10**(i-1))
        # print("i", i)
    ans += int(N) - 10**(l-1) + 1
    print(ans)

Submission status: Accepted

Solution code:
N = input()
length = len(N)

count = 0
last = 0
for i in range(length-1):
    last = i
    if i % 2 == 0:
        count += 9*(10**i)

number = int(N)
if length == 1:
    count = number
elif last%2 == 1:
    count += number + 1 - 10**(last+1)
print(count)

Submission status: Accepted

Solution code:
import numpy as np

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

    i = 1
    ans = 0
    while N >= 10**i:
        if i % 2 == 1:
            ans += 9 * 10**(i-1)
        i += 1

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

    print(ans)





if __name__ == "__main__": 
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
d1 = 9 - 1 + 1
d3 = 999 - 100 + 1
d5 = 99999 - 10000 + 1

n_len = 1
n_copy = n
while n_copy >= 10:
    n_copy = n_copy // 10
    n_len += 1

if n_len == 6:
    print(d1 + d3 + d5)
elif n_len == 5:
    print(d1 + d3 + (n-10000+1))
elif n_len == 4:
    print(d1 + d3)
elif n_len == 3:
    print(d1 + (n-100+1))
elif n_len == 2:
    print(d1)
elif n_len ==1:
    print(n)

Submission status: Accepted

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    token = lines[0].split()
    n = int(token[0])

    return (n, )


def solve(n):

    count = 0
    for i in range(1, n+1):

        if 1 <= i and i <= 9:
            count = count + 1

        if 100 <= i and i <= 999:
            count = count + 1

        if 10000 <= i and i <= 99999:
            count = count + 1

    return count


def main():
    # 出力

    print("%s" % solve(*parse_input()))

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

Submission status: Accepted

Solution code:
n = input()

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

Submission status: Accepted

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

for i in range(3):
    tmp_N = min(N,10**(1+2*i)-1)
    answer += max(0, tmp_N-10**(2*i)+1)
    
print(answer)

Submission status: Accepted

Solution code:
N = input()
s = len(N)
i = 0
count = 0
while i < s - 1:
    count += 9 * (10 ** i)
    i += 2
n = int(N)
if s % 2 == 1:
    count += n - (10 ** (s - 1)) + 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
if N == 10**5:
  ans = 90909
elif N >= 10**4:
  ans = 9+900+(N-10**4+1)
elif N >= 10**3:
  ans = 909
elif N >= 10**2:
  ans = 9+(N-10**2+1)
elif N>=10:
  ans = 9
else:
  ans = N

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

if n < 9:
    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:
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:
a=input()
c=int(a)
b=len(a)
ans=0
if b==1:
    print(c)
elif b==2:
    print(9)
elif b==3:
    print(9+c-99)
elif b==4:
    print(9+900)
elif b==5:
    print(9+900+c-9999)
elif b==6:
    print(9+900+90000)

Submission status: Accepted

Solution code:
n = int( input() )

ans = n

if n < 10:
    ans = n
elif n < 100:
    ans = 9
elif n < 1000:
    ans = n - 90
elif n < 10000:
    ans = 9 + 900
elif n < 100000:
    ans = n - 9000 - 90
else:
    ans = 9 + 900 + 90000

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2**31-1)
input = sys.stdin.readline
write = sys.stdout.write
LMIIS = lambda : list(map(int,input().split()))
II = lambda : int(input())
dbg = lambda *something : print(*something) if DEBUG is True else 0
DEBUG = True

def main():

    N = input()

    l = len(N) - 1
    N = int(N)
    count = 0
    if l % 2 == 1:
        count += N - 10**(l-1) + 1
    i = 1
    while i < l:
        count += 10**i - 10**(i-1)
        i += 2
    print(count)




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

Submission status: Accepted

Solution code:
N = int(input())

if (N // 10) < 1:
    print(N)
elif (N // 100) < 1:
    print(9)
elif (N // 1000) < 1:
    print(N- 90)
elif (N // 10000) < 1:
    print(909)
elif (N // 100000) < 1:
    print(N - 9090)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


n = int(input())

if n < 10:
    print(n)
elif 10 <= n and n < 10**2:
    print(9)
elif 10**2 <= n and n < 10**3:
    print(9+n-99)
elif 10**3 <= n and n < 10**4:
    print(9+900)
elif 10**4 <= n and n < 10**5:
    print(9+900+n-9999)
elif n == 10 ** 5:
    print(9+900+90000)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#A
N=int(input())
a=len(str(N))
if(a==1):
    ans=N
elif(a==2):
    ans=9
elif(a==3):
    ans=(N-99)+9
elif(a==4):
    ans=909
elif(a==5):
    ans=(N-9999)+909
elif(a==6):
    ans=90909
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

if N < 10:
    ret = N

elif N < 100:
    ret = 9

elif N < 1000:
    ret = N - 90

elif N < 10000:
    ret = 909

elif N < 100000:
    ret = N - 9090

elif N == 100000:
    ret = 90909

print(ret)

Submission status: Accepted

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

num_list_s=[1,100,10000]
num_list_e=[10,1000,100000]

cnt=0
for n in range(N+1):
    for l in range(3):
        if n >= num_list_s[l] and n < num_list_e[l] :
            cnt+=1
print(cnt)

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(900 + 9)
elif N < 100000:
    print(N - 9999 + 909)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

if i==len(str(N)):
	ans += (N - 10**(i-1)+1)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

def check(num):
    # print(num)
    if num//100000 != 0:
        return False
    elif num//10000 != 0:
        #print(10000,N//10000)
        return True
    elif num//1000 != 0:
        #print(1000,N//1000)
        return False
    elif num//100 != 0:
        #print(100,N//100)
        return True
    elif num//10 != 0:
        #print(10,N//10)
        return False
    else:
        #print(N)
        return True

print(sum(check(i) for i in range(1,N+1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n = int(input())
    digits = len(str(n))

    ans = 0
    for i in range(1, digits+1):
        if i % 2 == 0:
            continue

        limit = n+1 if i == digits else 10**i
        for j in range(10**(i-1), limit):
            ans += 1

    print(ans)

Submission status: Accepted

Solution code:
N = int(input())

num = 0

if N == 100000:
    num = 90909
elif 9999 < N < 100000:
    num = 909 + N -9999
elif 999 < N  <= 9999:
    num = 909
elif 99 < N <= 999:
    num = 9 + N -99
elif 9 < N <= 99:
    num = 9
else:
    num = N

print(num)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N=int(input())

if int(N/(10**5))>=1:
    print((10-1)+(10**3-10**2)+(10**5-10**4))
elif int(N/(10**4))>=1:
    print((10-1)+(10**3-10**2)+(N+1-10**4))
elif int(N/(10**3))>=1:
    print((10-1)+(10**3-10**2))
elif int(N/(10**2))>=1:
    print((10-1)+(N+1-10**2))
elif int(N/10)>=1:
    print(10-1)
else:
    print(N+1-1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
result = 0
for i in range(n):
    k = len(str(i+1))
    if k % 2 == 1:
        result += 1
print("{}".format(result))

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
if int(N/10) >= 1:
  ans += 9
  if int(N/1000) >= 1:
    ans += 900
    if int(N/100000) >= 1:
      ans += 90000
    else:
      ans += max(N - 9999, 0)
  else:
    ans += max(N - 99, 0)
else:
  ans += N

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
if 1 <= n <= 9:
    print(n)
if 10 <= n <= 99:
    print(9)
if 100 <= n <= 999:
    print(n-99+9)
if 1000 <= n <= 9999:
    print(900+9)
if 10000 <= n <= 99999:
    print(n-9999+900+9)
if 100000 <= n <= 999999:
    print(90000+900+9)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
if N >= 9:
  ans += 9
else:
  ans += N
if N >= 999:
  ans += 900
elif N >= 100:
  ans += N - 99
if N >= 99999:
  ans += 90000
elif N >= 10000:
  ans += N - 9999
print(ans)

Submission status: Accepted

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

# input
N = int(input())

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

# output
print(ans)

Submission status: Accepted

Solution code:
N = input()
length = len(N)
n = int(N)
dic = {1:9,3:900,5:90000}
if length == 1:
    ans = n
elif length == 2:
    ans = 9
elif length == 3:
    ans = n - 90
elif length == 4:
    ans = 909
elif length == 5:
    ans = n - 9090
elif length == 6:
    ans = 90909
print(ans)

Submission status: Accepted

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

if nketa > 1:
    for i in range(1,nketa):
        if i%2 == 1:
            ans += 10**i - 10**(i-1)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

res=0
if n < 10:
    res=n
elif 10 <= n and n < 10**2:
    res=9
elif 10**2 <= n and n < 10**3:
    res=9+(n-10**2)+1
elif 10**3 <= n and n < 10**4:
    res=9+900
elif 10**4 <= n and n < 10**5:
    res=9+900+(n-10**4)+1
elif n == 10**5:
    res = 9 + 900 + 90000
else:
    pass
print(res)

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

keta = len(str(N))

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
def uneven_num(n):
    count = 0
    for i in range(n,0,-1):
        tmp = i
        keta = 0
        while True:
            tmp = tmp/10
            if tmp < 1:
                keta += 1
                break
            else:
                keta += 1

        if keta % 2 != 0:
            count += 1

    return count

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

    a = uneven_num(n)
    print("%d" %a)

Submission status: Accepted

Solution code:
s = input()

n = len(s)

s = int(s)
i = 1
ans = 0
while i < n:
  ans += 9 * (10**(i-1))
  i += 2
if i==n:
  ans += s - 10**(n-1) +1
  
print(ans)

Submission status: Accepted

Solution code:
N = input()
len_n = len(N)

ans = 0
if len_n % 2 == 0:
    for i in range(len_n // 2):
        ans += 9 * pow(10, 2*i)
else:
    for i in range(len_n // 2):
        ans += 9 * pow(10, 2*i)
    ans += int(N) - pow(10, 2*(len_n // 2)) + 1
print(ans)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:

N = int(input())

L = 0 # Nの桁数
t = N
while t:
    L += 1
    t = t // 10

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

#print("==", ans)
if L % 2 == 1:
    ans += N - 10**(L-1) + 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(n - 90)
elif n < 10000:
  print(909)
elif n < 100000:
  print(9 + 900 + (n - 9999))
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 != 0:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

length = len(str(N))

ans = 0

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

for i in range(1, length+1, 2):
    if i == length:
        break
    ans += 10 ** i - (10**(i-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())
lists = list(range(1,N+1))
cnt = 0
for i in range(len(lists)):
    m = str(lists[i])
    if len(m) % 2 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = str(input())
m = len(n)
n = int(n)
x = 9
ans = 0
if m%2 == 0:
    for _ in range((m+1)//2):
        ans += x
        x *= 100

else:
    for _ in range((m+1)//2-1):
        ans += x
        x *= 100
    ans += n - 10**(m-1) +1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n = N
ans = 0
k = 0
while True:
  m = n//(10**k)
  if(m <  10):
    break
  k += 1
for i in range(k):
  if(i%2==0):
      ans += 9*(10**i)
if (k%2 == 0):
    d = n - (10**k)+1
    ans += d
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
m = int(np.log10(n))
ans = 0

for i in range(m+1):
    if m%2 == 1:
        n = 10**m - 1
        m -= 1
    else:
        ans += n - 10**m + 1 
        n = 10**m - 1
        m -= 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    ans = 0
    if N < 10:
        ans = N
    elif N < 100:
        ans = 9
    elif N < 1000:
        ans = 9 + ( N - 100 + 1 )
    elif N < 10000:
        ans = 9 + 900 
    elif N < 100000:
        ans = 9 + 900 + ( N - 10000 + 1 )
    else:
        ans = 9 + 900 + 90000
    print( ans )

Submission status: Accepted

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

digit = []
count = 0
for l in L:
    d = len(str(l))
    if d % 2 == 1:
        count += 1

print(count)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    nstr = str(n)
    nlen = len(nstr)
    ans0 = [0, 0, 9, 9, 909, 909, 90909][nlen]
    if nlen % 2 == 0:
        print(ans0)
        return
    print(ans0 + n - 10 ** (nlen - 1) + 1)


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
n=str(N)
k=len(n)

if k==1:
    print(N)
elif k==2:
    print(9)
elif k==3:
    print((N//100-1)*100+N%100+10)
elif k==4:
    print(909)
elif k==5:
    print((N//10000-1)*10000+N%10000+910)
else:
    print(90909)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
ans = 0
n = int(raw_input())
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 N <= 9:
    A = N
elif N <= 99:
    A = 9
elif N <= 999:
    A = N - 90
elif N <= 9999:
    A = 909
elif N <= 99999:
    A = N - 9090
else:
    A = 90909
print(A)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())


for i in range(1,7):
    if (n < 10**i):
        keta = i
        break

#print(keta)

rtn = 0

if (keta == 1):
    rtn += n
elif (keta > 1):
    rtn += 9

if (keta == 3):
    rtn += n - 99
elif (keta > 3):
    rtn += 900

if (keta == 5):
    rtn += n - 9999
if (keta > 5):
    rtn += 90000

print(rtn)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    lst  = list(range(1,n+1))

    lst = [len(str(i)) for i in lst]

    lst = [i for i in lst if i%2 == 1]

    print(len(lst))
    
if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

args = input().split()
N = int(args[0])

count = 0
for i in range(1, N+1):
    num_count = 0
    i = str(i)
    for s in i:
        num_count = num_count + 1
    if num_count % 2 ==0:
        pass
    else:
        count = count + 1

print(count)

Submission status: Accepted

Solution code:
N = input()
digit = len(N)
N = int(N)
cnt=0
if digit == 1:
    cnt = N
elif digit == 2:
    cnt = 9
elif digit == 3:
    cnt = 9
    cnt += N-100+1
elif digit == 4:
    cnt = 909
elif digit == 5:
    cnt = 909
    cnt += N-10000+1
elif digit == 6:
    cnt = 90909
    
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces680B
gi = lambda : list(map(int,input().split()))
n, = gi()
mag = 1
ans = 0
while 1:
	if mag > n:
		break;
	if 10 * mag > n:
		ans += n - mag + 1
		break
	ans += 9 * mag
	mag *= 100
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
if N < 10:
    print(N)
elif N < 99:
    print(9)
elif N < 1000:
    print(N-(99-10+1))
elif N < 9999:
    print(999 - (99-10+1))
elif N < 100000:
    print(N-(9999-1000+1)-(99-10+1))
else:
    print(N-1-(9999-1000+1)-(99-10+1))

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:
def main():
    n = int(input())
    ans = 0
    for i in range(1, n + 1):
        if i <= 9:
            ans += 1
        elif 100 <= i <= 999:
            ans += 1
        elif 10000 <= i <= 99999:
            ans += 1
        else:
            continue
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
num = 0
A = len(str(N))
if A == 1:
  print(N)
  exit()
elif A == 2:
  print(9)
  exit()
elif A == 3:
  print(9+N-99)
  exit()
elif A == 4:
  print(909)
  exit()
elif A == 5:
  print(909+N-9999)
  exit()
elif A == 6:
  print(90909)
  exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

def main():
    # # 整数の入力
    # a = int(input())
    # # スペース区切りの整数の入力
    # b, c = map(int, input().split())
    # # 文字列の入力
    # s = input()
    # # 出力
    # print("{} {}".format(a+b+c, s))
    N = int(input())
    cnt = 0
    for i in range(1,N+1):
        if get_keta(i) % 2 != 0:
            cnt += 1
    print(cnt)

def get_keta(N):
    return len(str(N))

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

keta = len(str(n))

ans = 0

cnt = keta // 2
for i in range(cnt):
    ans += 9 * 10 ** (i*2)
    

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

Submission status: Accepted

Solution code:
N = int(input())

if N == 10 ** 5:
    count = 10 ** 5 - 10 ** 4 + 10 ** 3 - 10 ** 2 + 10 - 1
elif N >= 10 ** 4:
    count = N - 10 ** 4 + 1 + 10 ** 3 - 10 ** 2 + 10 - 1
elif N >= 10 ** 3:
    count = 10 ** 3 - 10 ** 2 + 10 - 1
elif N >= 10 ** 2:
    count = N - 10 ** 2 + 1 + 10 - 1
elif N >= 10:
    count = 10 - 1
else:
    count = N

print(count)

Submission status: Accepted

Solution code:
N=int(input())
tmp=[10**i for i in range(0,6,2)][::-1]
ans=0
for i in tmp:
    if i<=N:
        if N>=i*10:
            ans+=i*9
        else:
            ans+=N-i+1
print(ans)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa == x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))

n = list(input())

if len(n) == 1:
    k = int("".join(map(str,n)))
    print(k)
elif len(n) == 2:
    print(9)
elif len(n) == 3:
    k = int("".join(map(str,n)))
    print(9 + k -99)
elif len(n) == 4:
    print(909)
elif len(n) == 5:
    k = int("".join(map(str,n)))
    print(9 + 900 + k - 9999)
else:
    print(90909)

Submission status: Accepted

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

    for i in range(1,N+1):
        S = str(i)
        s_len = len(S)
        if is_even(s_len) == False:
            count = count + 1
            #print(S)

    print(count)

def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False

if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
N = int(input())

if 1 <= N < 10: print(N)
elif 10 <= N < 100: print(9)
elif 100 <= N < 1000: print(9 + N - 100 + 1)
elif 1000 <= N < 10000: print(9 + 900)
elif 10000 <= N < 100000: print(9 + 900 + N - 10000 + 1)
else: print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
n = int(input())

if n < 10:
    ans = n
elif n < 100:
    ans = 9
elif n < 1000:
    ans = n - 100 + 10
elif n < 10000:
    ans = 909
elif n < 100000:
    ans = n - 10000 + 910
elif n == 100000:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

digit = (len(str(N)))
#print(digit)

if digit == 1:
  print(N)
elif digit == 2:
  print(9)
elif digit == 3:
  print(N - 99 + 9)
elif digit == 4:
  print(909)
elif digit == 5:
  print(N - 9999 + 999 - 99 + 9)
else:
  print(90909)

Submission status: Accepted

Solution code:
def hoge(n):
    return 10 ** n - 10 ** (n - 1)

N = input().strip()
o = len(N)
N = int(N)

ans = 0
for i in range(o):
    if i % 2 == 0:
        continue
    ans += hoge(i)

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#ARC65C
import copy
import sys
#import math

tmp = int(input())

ans=0
if(tmp==100000):
	ans=90909
elif(tmp>=10000):
	ans+=tmp-9999
	ans+=900
	ans+=9
elif(tmp>=1000):
	ans+=900
	ans+=9
elif(tmp>=100):
	ans+=tmp-99
	ans+=9
elif(tmp>=10):
	ans+=9
else:
	ans+=tmp

print(ans)

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(10+int(n)-100)
elif len(n)==4:
    print(909)
elif len(n)==5:
    print(910+int(n)-10000)
else:
    print(90909)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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