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

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

    return odd_count

print(ans136(N))

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# import math
# import statistics
# import itertools
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(int(i))
# H,W,K= map(int,input().split())
# f = list(map(int,input().split()))
# g = [input().split for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen

lis=[str(i) for i in range(1,a+1)]

count=0
for i in lis:
    if int(len(i))%2!=0:
        count+=1
print(count)

Submission status: Accepted

Solution code:
import math

N = int(input())
m = int(math.log10(N))+1
a = N//(pow(10,m))

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

if m%2 == 1:
    ans += N-pow(10,m-1)+1
print(ans)

Submission status: Accepted

Solution code:
import math
import collections
import itertools

def resolve():

    N=int(input())

    ans=0
    for i in range(1,N+1):
        if(10<=i<=99 or 1000<=i<=9999 or 100000<=i<=999999):
            continue
        ans+=1
    print(ans)
resolve()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    # s = input()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
print(sum([len(str(x + 1)) % 2 for x in range(0, int(input()))]))

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())
i = 5
while True:
  if (n//(10**i) != 0):
    break
  i = i - 1
i = i + 1

if (i%2 == 0):
  i = i//2
  ans = 0
  for j in range(i):
    ans = ans + 9*10**(2*j)
  print(ans)
else:
  i2 = (i - 1)//2
  ans = 0
  for j in range(i2):
    ans = ans + 9*10**(2*j)
  tmp = 0
  for j in range(i - 1):
    tmp = tmp + 9*(10**j)
  ans = ans + n - tmp
  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(9+n-100+1)
  
elif n < 10**4:
  print(909)
  
elif n < 10**5:
  print(909+n-10000+1)

else:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
nums = int(input())
total = 0

for num in range(1, nums+1):
    len_num = len(str(num))
    if len_num % 2 == 1:
        total += 1

print(total)

Submission status: Accepted

Solution code:
N = int(input())
if len(str(N)) == 1:
  ans = N
elif len(str(N)) == 2:
  ans = 9
elif len(str(N)) == 3:
  ans = N - 99 +9
elif len(str(N)) == 4:
  ans = 999 -99 + 9
elif len(str(N)) == 5:
  ans = N - 9999 + 999 - 99 +9
else:
  ans = 99999 - 9999 + 999 -99 +9
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 len(str(i)) % 2 == 1: ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ichi = 9
hyaku = 900
man = 90000
if N < 10:
  print(N)
elif 10 <= N < 100:
  print(ichi)
elif 100 <= N <= 999:
  ans = N - 99
  print(ichi+ans)
elif 1000 <= N <= 9999:
  print(ichi+hyaku)
elif 10000 <= N <= 99999:
  ans = N - 9999
  print(ichi+hyaku+ans)
else:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())

ans = 0

for i in range(int(math.log10(N)) + 1):
    if i % 2 != 0:
        pass
    elif i == int(math.log10(N)):
        ans += N - 10**i + 1
    else:
        ans += 10**(i+1) - 10**i

print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
keta = math.floor(math.log(N, 10)) + 1
ans = 0
for i in range(1, keta):
    if i % 2 == 1:
        ans += 9 * pow(10, i - 1)
if keta % 2 == 1:
    ans += N - pow(10, keta - 1)+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
l = len(str(N))
d = [0,9,0,900,0,90000]
res = 0
for i in range(l):
  res += d[i]
if l == 1:
  res += N
if l == 3:
  res += (N - 99)
if l == 5:
  res += (N - 9999)
print(res)

Submission status: Accepted

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

d = n - 10**(l-1)
print(s+d+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

for i in range(d): #10**i~9999←i+1個
  if (i+1)%2==1:
    ans+=10**(i+1)-10**i
    

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

print(ans)

Submission status: Accepted

Solution code:
a=int(input())
print(min(a,9)+max(99,min(999,a))-max(min(99,a),99)+max(9999,min(99999,a))-max(min(9999,a),9999))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

cnt = 0
for i in range(1, N+1):
    k = 0
    while True:
        k += 1
        if 10 ** k > i: break
    if k % 2 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
cnt = 0
for i in range(1, n+1):
    if len(str(i))&1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
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())
num = len(str(n))
if num == 1:
    ans = n
else:
    if num&1==1:
        ans = (n%(10**(num-1)))+1+(n//(10**(num-1))-1)*(10**(num-1))
        num -=2
    else:
        ans = 0
        num -= 1
    n %= 10**num
    while num>0:
        ans += 9*(10**(num-1))
        num -=2
        n %= 10**num
print(ans)

Submission status: Accepted

Solution code:
# 与えられた数値の桁数と桁値の総和を計算する.
def calc_digit_sum(num):
    digits = sums = 0
    while num > 0:
        digits += 1
        sums += num % 10
        num //= 10
    return digits, sums


n = int(input())

cnt = 0
for index in range(1, n+1):
    digit, _ = calc_digit_sum(index)
    if digit % 2 != 0:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
a = int(input())
if a <= 9:
  print(a)
elif a <= 99:
  print(9)
elif a <= 999:
  print(a - 90)
elif a <= 9999:
  print(909)
elif a <= 99999:
  print(a - 9090)
else:
  print(90909)

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((N-100+1)+9)
elif 1000 <= N < 10000:
    print(9+900)
elif 10000 <= N < 100000:
    print((N-10000+1)+900+9)
else:
    print(90000+900+9)

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

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
a=int(input())
if a<10:
  print(a)
if 10<=a<100:
  print(9)
if 100<=a<1000:
  print(9+a-99)
if 1000<=a<10000:
  print(909)
if 10000<=a<100000:
  print(909+a-9999)
if a==100000:
  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=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:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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())
n=list(str(N))
if len(n)==6:
    print(9+900+90000)
elif len(n)==5:
    print(9+900+N-9999)
elif len(n)==4:
    print(909)
elif len(n)==3:
    print(N-99+9)
elif len(n)==2:
    print(9)
else:
    print(N)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    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:
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:
#
# author Sidratul
#

from math import prod

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(count)

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count= 0
for i in range(1,n+1):
    if len(str(i)) == 1 or len(str(i)) == 3 or len(str(i)) == 5:
        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:
import math
N=int(input())
order=math.floor(math.log10(N))+1
ans=0
for od in range(1,order+1,2):
    if N<10**od:
        ans+=(N-10**(od-1)+1)
        break
    else:
        ans+=9*10**(od-1)
        od+=1
print(ans)

Submission status: Accepted

Solution code:
def calc_num_digits(x):
    num_digits = 0
    while True:
        if x // 10 == 0:
            num_digits += 1
            break
        x //= 10
        num_digits += 1
    return num_digits


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

    for i in range(1, n + 1):
        num_digits = calc_num_digits(i)
        if num_digits % 2 == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

def numlen(n):
	return len(str(n))

ans = 0
for j in range(1, n+1):
	if numlen(j)%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())

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

Submission status: Accepted

Solution code:
# ABC136
# B Uneven Numbers
# N以下の整数で桁数が奇数のものの数
n = int(input())
ct = 0
for i in range(1,n+1):
    if len(str(i)) % 2:
        ct +=1
print(ct)

Submission status: Accepted

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

main()

Submission status: Accepted

Solution code:
N = int(input())
if N < 100:
  print(min(9, N))
elif N < 10000:
  print(9 + min(N, 999) - 99)
else:
  print(9 + 900 + min(N, 99999) - 9999)

Submission status: Accepted

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

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:
num = input()
length, res = len(num), 0
big, small = "9", "1"

for dig_len in range(1, length + 1, 2):
    if int(big) < int(num):
        res += int(big) - int(small) + 1
        big += "99"
        small += "00"
    else:
        res += int(num) - int(small) + 1

print(res)

Submission status: Accepted

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

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


count=len(str(n))
ans=''
if count%2==0:
    for i in range(count-1):
        if i%2==0:
            ans+='9'
        else:
            ans+='0'
else:
    ans=(count//2)*'90'
    try:
        ans=n-int(ans)
    except:
        ans=n
print(int(ans))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 問題：https://atcoder.jp/contests/abc136/tasks/abc136_b

n = int(input())
ln_n = len(str(n))
if ln_n % 2 == 0:
    n = 10 ** (ln_n - 1) - 1

res = 0
for i in range(1, ln_n):
    if i % 2 == 1:
        res += 10 ** i - 10 ** (i - 1)
res += n + 1 - 10 ** (ln_n - 1)

print(res)

Submission status: Accepted

Solution code:
N = int(input())

ans = -1

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

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

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())
nlen =len(str(n))
ans = 0
 
if n <= 9:
  print(n)
else:
  for i in range(1,nlen):
    if i % 2 == 1:
      ans += 10 ** i -10 ** (i-1)
  if nlen % 2 == 1:
    ans = ans + (n - 10**(nlen-1) + 1)
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

n0=n
k=1
for i in range(6):
    if n0<10 :
        break
    n0//=10
    k+=1
if k==1 :
    ans = n%10
else:
    ans = 9
    if k>=3 :
        ans += min(900,n-99)
        if k>=5 :
            ans += min(90000,n-9999)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(1,10**5+1):
    if (i <= n) and (len(str(i)) in [1,3,5]):
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
#! python3
#  solve_136B.py

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:
#
# abc136 b
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """11"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """136"""
        output = """46"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """100000"""
        output = """90909"""
        self.assertIO(input, output)


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

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


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for i in range(n+1):
    if len(str(i)) in {1, 3, 5}:
        cnt += 1
print(cnt -1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

keta=len(str(n))

cnt=0

if keta%2==0:
    cnt+=9
    for i in range(4,keta+1,2):
        cnt+=9*(100**((i-2)//2))
        
if keta%2!=0:
    cnt+=9
    if keta==3:
        cnt+=n-99
    else:
        for i in range(5,keta+1,2):
            cnt+=9*(100**((i-3)//2))
            cnt+=n-(10**(i-1)-1)            

if keta==1:
    print(n)
else:
    print(cnt)

Submission status: Accepted

Solution code:
n = input()

digit = len(n) 
ans = 0

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

if N <= 9:
  print(N)
elif N <= 99:
  print(9)
elif N <= 999:
  print(9+(N-99))
elif N <= 9999:
  print(909)
elif N <= 99999:
  print(909+(N-9999))
elif N == 100000:
  print(90909)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
N = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
import sys
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):
    l = len(str(i))
    if l % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import math

N = int(input())

ans = 0
for i in range(1, N+1):
    if (math.floor(math.log10(i)) + 1) % 2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
X = input()

def solve(X):
    if X == '0':
        return 0
    if len(X) % 2 == 0:
        ans = 0
        y = len(X)
        while (y > 1):
            if y % 2 == 0:
                ans += 9 * 10**(y-2)
            y -= 2
        return ans 
    else:
        ans = int(X) - 10**(len(X)-1) + 1
        return ans + solve(str(10**(len(X)-1)-1))

print(solve(X))

Submission status: Accepted

Solution code:
N = int(input())

def cnt(x, y):
    return y - x + 1

for i in range(1, 7):
    if 10 ** (i - 1) <= N < 10 ** i:
        dig = i
        # print(dig)
        if dig == 1:
            print(cnt(1, N))
        elif dig == 2:
            print(cnt(1, 9))
        elif dig == 3:
            print(cnt(1, N) - cnt(10, 99))
        elif dig == 4:
            print(cnt(1, N) - cnt(10, 99) - cnt(1000, N))
        elif dig == 5:
            print(cnt(1, N) - cnt(10, 99) - cnt(1000, 9999))
        elif dig == 6:
            print(cnt(1, N) - cnt(10,99) - cnt(1000,9999) - cnt(100000, N))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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

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(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 = 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())
ans = 0
 
for i in range(1, N + 1):
  if (len(str(i)) % 2 == 1):
      ans += 1
  else:
      continue
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:
import math
N=int(input())
a=0
for i in range(1,N+1):
    if ((math.log10(i))//1)%2==0:
        a+=1
print(a)

Submission status: Accepted

Solution code:
n = int(input())

unit = 10
cnt = 0
flg = 1

for i in range(1,n+1):
    if i//unit < 1:
        if flg==1:
            cnt+=1
    else:
        unit*=10
        flg^=1
        if flg==1:
            cnt+=1

print(cnt)

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

print(cnt-1)

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(N-90)
elif 1000<=N<10000:
  print(909)
elif 10000<=N<100000:
  print(N-9090)
else:
  print(90909)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in range(0, 3):
    for j in range(1*(100**i), 10*(100**i)):
        if j<=n:
            ans += 1
        else:
            print(ans)
            exit()
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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