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())
s = len(str(n))

if s == 1:
    print(n)
elif s == 2:
    print(9)
elif s % 2 == 0:
    k = s//2
    sum = 0
    t = 1
    for i in range(1,k+1):
        sum += 9*t
        t *= 100
    print(sum)
        
else:
    k = (s-1)//2
    sum = 0
    t = 1
    for i in range(1,k+1):
        sum += 9*t
        t *= 100
    print(sum + n -10**(s -1) +1)

Submission status: Accepted

Solution code:
n = input()
nlen = len(n)

if nlen > 5:
  n5 = 90000
  n3 = 900
  n1 = 9
elif nlen == 5:
  n5 = int(n[-5:]) - 9999
  n3 = 900
  n1 = 9
elif nlen >3:
  n5 = 0
  n3 = 900
  n1 = 9
elif nlen == 3:
  n5 = 0
  n3 = int(n[-3:]) - 99
  n1 = 9
elif nlen > 1:
  n5 = 0
  n3 = 0
  n1 = 9
else:
  n5 = 0
  n3 = 0
  n1 = int(n[-1:])

print(n1 + n3 + n5)

Submission status: Accepted

Solution code:
N = int(input())

keta = len(str(N))

count = 0
for k in range(1, keta+1, 2):
  if k != keta:
    count += (10**(k) - 10**(k-1))
  elif k == keta:
    count += (N - 10**(k-1) + 1)
    
print(count)

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n=input()

a=len(n)

n=int(n)

if a%2==1:
  
  print(int((100**(a//2)-1)/11+n-10**(a-1)+1))
  
else:
  
  print(int((100**(a/2)-1)/11))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
digit= int(np.log10(n)//1)
tmp = 0
if digit%2==0 and n>=10:
  tmp = n-10**digit+1
elif n<10:
  tmp = n
for i in range(1,digit+1,2):
    tmp += 9*10**(i-1)
print(tmp)

Submission status: Accepted

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

ans = 9
if (ketasu % 2 == 0) and (ketasu != 2):
    for i in range(2, ketasu, 2):
        ans += 9*(10**(i))
elif (ketasu % 2 != 0) and (ketasu != 1):
    for i in range(2, ketasu-1, 2):
        ans += 9*(10**(i))
    ans = ans + (N - 10**(ketasu-1) + 1)

if ketasu == 1:
    ans = N

print(ans)

Submission status: Accepted

Solution code:
N=str(input())
digit=len(N)
result=0

for i in range(1,digit+1):
    if i%2==1:
        if i==digit:
            result+=int(N)+1-10**(i-1)
        else:
            result+=9*10**(i-1)
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
l=len(n)
s=0
if l>1:
    if l%2==1:
        s+=int(n[1:])+1+(int(n[0])-1)*(10**(l-1))
        l-=1
    for i in range(int(l/2)):
        s+=9*10**(i*2)
    print(s)
else:
    print(int(n))

Submission status: Accepted

Solution code:
n = int(input())
length = len(str(n))
cnt = 0
odd_l = []
for i in range( len(str(n))):
    if ((i+1)%2 == 1) & (i != len(str(n))-1):
        cnt += 10**(i+1)-(10**i)
    elif (i+1)%2 == 1:
        for i in range(10**i, n+1):
            cnt += 1
            odd_l.append(i)
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())

if n<=9:
	res=n
else:
	if n<=99:
		res=9
	else:
		if n<=999:
			res=n-99+9
		else:
			if n<=9999:
				res=909
			else:
				if n<=99999:
					res=n-9999+909
				else:
					res=90909

print(res)

Submission status: Accepted

Solution code:
N = input()
length = len(N)
count = 0
for i in range(1, length, 2):
    count = count + 10 ** i - 1 - 10 ** (i - 1) + 1

if length % 2 != 0:
    count = count + int(N) - 10 ** (length - 1) + 1

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input()) + 1
r, i = 0, 1
while 10 * i <= n:
    r += 9 * i
    i *= 100
print(r + max(0, n - i))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

p = 1
ans = 0
while 10**p <= N:
    if p&1:
        ans += 10**p - 10**(p-1)
    p += 1

if p&1:
    p -= 1
    ans += N - (10**p) + 1

print(ans)

Submission status: Accepted

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

if l == 6:
    ans = 90909
elif l == 5:
    ans = 909 + n - 10000 + 1
elif l == 4:
    ans = 909
elif l == 3:
    ans = 9 + n - 100 + 1
elif l == 2:
    ans = 9
else:
    ans = n 
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
n1 = n

count = 0
while(n1 > 0):
    n1 = n1 // 10
    count = count + 1

if count == 1:
    print(n)
elif count == 2:
    print(9)
elif count == 3:
    print(9 + (n - 100) + 1)
elif count == 4:
    print(909)
elif count == 5:
    print(909 + (n - 10000) + 1)
else:
    print(90909)

Submission status: Accepted

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

x= len(str(N))

# print(x)

if(not x%2==0):
    total+= (N-(10**(x-1)))+1
    x -= 1

# print(total)

for i in range(x):
    if (i%2==0):
        total+= 9*(10**i)

print(total)

Submission status: Accepted

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


def main():
    N = input().strip()
    ans = 0
    for i in range(0, len(N)-1, 2):
        ans += 9 * 10**i

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a = [9, 99, 999, 9999, 99999, 999999]

str = input()
org = int(str)
c = len(str)

if c == 1:
  ans = org
elif c == 2:
  ans = a[0]
elif c == 3:
  ans = a[0] + org - a[1]
elif c == 4:
  ans = a[0] -a[1] + a[2]
elif c == 5:
  ans = a[0] -a[1] + a[2] - a[3] + org
else:
  ans = a[0] -a[1] + a[2] - a[3] + a[4]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
n_ = input()
n = int(n_)

levels = [9, 0, 900, 0, 90000, 0]

if n == 10**5:
    print(sum(levels))
if len(n_) == 5:
    print(sum(levels[:4]) + n - 10000 + 1)
if len(n_) == 4:
    print(sum(levels[:3]))
if len(n_) == 3:
    print(sum(levels[:2]) + n - 100 + 1)
if len(n_) == 2:
    print(sum(levels[:1]))
if len(n_) == 1:
    print(n)

Submission status: Accepted

Solution code:

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

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:
n = int(input())
a = 0
for i in [1,3,5]:
    max = pow(10, i)
    min = pow(10, i-1)
    if n >= max-1:
        a += 9 * min
    elif n >= min:
        a += n-min+1
        break
    else:
        break
print(a)

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

cnt = 0
for i in [1, 3, 5]:
    int_quot = n // (10 ** i)
    if n < (10 ** (i - 1)):
        break
    if int_quot == 0:
        cnt += n - 10 ** (i-1) + 1
    else:
        cnt += (10 ** i - 1) - (10 ** (i - 1)) + 1


print(cnt)

Submission status: Accepted

Solution code:
# standart input
# n = int(input())
# a = list(map(int, input().split()))

n = int(input())
x = 0
count = 0

while n >= x:
    n_digit = 0
    xx = x
    while xx != 0:
        xx = xx // 10
        n_digit += 1
    if n_digit % 2 == 1:
        count += 1
    x += 1

print(count)

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


if __name__ == '__main__':
    """
    整数 N が与えられます。N 以下の正の整数のうち、(先頭に 0 をつけずに十進法で表記したときの)
    桁数が奇数であるようなものの個数を求めてください。

    制約
    1 ≤ N ≤ 10^5
    """
    main()

Submission status: Accepted

Solution code:
n = int(input())

if n<=9:
    print(n)
elif n<=99:
    print(9)
elif n<=999:
    s=9+n%100+1
    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 = int(input())
i = 0
ans = 0

while n-10**i >= 0:
    if not i & 1:
        if n-10**(i+1) < 0:
            ans += n - 10**i + 1
        else:
            ans += 10**i * 9

    i += 1

print(ans)

Submission status: Accepted

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

number = int(input())
count = 0

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

Submission status: Accepted

Solution code:
n = int(input())
i = 1
r = 0
while 10 * i <= n + 1:
    r += 9 * i
    i *= 100
print(r + max(0, n + 1 - i))

Submission status: Accepted

Solution code:
n = input()
le = len(n)

def count(x):
    k = len(x) // 2
    for i in range(k):
        if i==0:
            ans = '9'
        else:
            ans += '09'
    return (int(ans))

if le == 1:
    print(int(n))
    exit()

elif le % 2 == 0:
    ans = count(n)
else:
    nn = n[1:]
    ans = count(nn)
    ans += int(n) - 10**(le-1) + 1
print(ans)

Submission status: Accepted

Solution code:
N = str(input())
m = len(N)
ans = int(N) 
if m == 2:
    ans = 9
elif m == 3:
    ans -= 90
elif m == 4:
    ans = 909
elif m == 5:
    ans -= 10000
    ans += 1
    ans += 909
elif m == 6:
    ans = 90909
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

for i in range(1, x + 1):
  count = 0
  x = i
  while(x > 0):
    count += 1
    x = x // 10
  if count%2 == 1:
    ans += 1

    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
res = 0
for i in range(1,n+1):
    t = i
    var = 1
    while i >= 10:
        i = i//10
        var += 1
    if var % 2 ==1 :
        res+=1
    
print(res)

Submission status: Accepted

Solution code:
#n = (int(i) for i in input().split())  
n = int(input())
if n == 100000:
    print(9 + 900 + 90000)
elif n >= 10000:
    print(9 + 900 + n - 9999)
elif n >= 1000:
    print(9 + 900)
elif n >= 100:
    print(9 + n - 99)
elif n >= 10:
    print(9)
else:
    print(n)

Submission status: Accepted

Solution code:
import numpy as np
n=input()
n=int(n)
k=np.log10(n)
k=int(k)
a=0
if k % 2 == 0:
  a+=n-10**k+1
if n>=100000:
  a+=90909
elif n>=1000:
  a+=909
elif n>=10:
  a+=9
print(a)

Submission status: Accepted

Solution code:
n = int(input())
k = n
cnt = 1
while(n>0):
    if(n>=10):
        #print(n)
        n = n//10
        cnt += 1
    else:
        break
#print(cnt)
if(cnt == 1):
    print(k)
elif(cnt == 2):
    print(9)
elif(cnt == 3):
    print(9 + k-99)
elif(cnt == 4):
    print(9 + 900)
elif(cnt == 5):
    print(9 + 900 + k-9999)
elif(cnt == 6):
    print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    logging.info("Hello!")

    answer = 0

    if N < 10:
        answer = N
    elif N >= 10 and N < 100:
        answer = 9
    elif N >= 100 and N < 1000:
        answer = 9 + N % 100 + 1 + int(N // 100 - 1) * 100
    elif N >= 1000 and N < 10000:
        answer = 909
    elif N >= 10000 and N < 100000:
        answer = 909 + N % 10000 + 1 + int(N // 10000 - 1) * 10000
    else:
        answer = 90909

    print(answer)
        
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

if N == 10**5:
    print(90909)
elif N >= 10**4:
    print(9+len(range(10**2, 10**3))+len(range(10**4, N+1)))
elif N >= 10**3:
    print(9+len(range(10**2, 10**3)))
elif N >= 10**2:
    print(9+len(range(10**2, N+1)))
elif N >= 10:
    print(9)
elif N >= 1:
    print(N)

Submission status: Accepted

Solution code:
n = int(input())
cnt = 0
for x in range(n+1):
    if 1 <= x and x <=9:
        cnt+=1
    if 100 <= x and x <=999:
        cnt+=1
    if 10000 <= x and x <=99999:
        cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

Solution code:
n = input()

l = len(n)

if l == 1:
    print(int(n))
elif l == 2:
    print(9)
elif l == 3:
    print(9 + int(n) - 99)
elif l == 4:
    print(909)
elif l == 5:
    print(909 + int(n) - 9999)
elif l == 6:
    print(90909)

Submission status: Accepted

Solution code:
s = int(input())

g = 0
output = 0
for i in range(s):
    i = i + 1
    if int(len(str(i)))%2 == 0:
        g=1
    else:
        output = output + 1

        
print(output)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

Submission status: Accepted

Solution code:
test = False


def solve_a(test=False, a=0, b=0, c=0):
    if not test:
        a, b, c = map(int, input().split())
    d = max(c - (a - b), 0)
    print(d)


def solve_b(test=False, n=0):
    if not test:
        n = int(input())
    res = 0
    for i in range(1, n + 1):
        if len(str(i)) % 2 == 1:
            res += 1
    print(res)


def solve_c(test=False, n=0, h_list=[]):
    if not test:
        n = int(input())
        h_list = list(map(int, input().split()))
    res = 'Yes'
    new_h_list = [0] * n
    new_h_list[0] = h_list[0] - 1

    for i in range(1, n):
        # cannot down
        if h_list[i] == new_h_list[i - 1]:
            new_h_list[i] = h_list[i]
        elif h_list[i] < new_h_list[i - 1]:
            new_h_list[i] = h_list[i]
            res = 'No'
        else:
            new_h_list[i] = h_list[i] - 1
    print(res)


if __name__ == "__main__":
    if test:
        solve_a(test=True, a=6, b=4, c=3)
        solve_a(test=True, a=8, b=3, c=9)
        solve_a(test=True, a=12, b=3, c=7)
        solve_b(test=True, n=11)
        solve_b(test=True, n=136)
        solve_b(test=True, n=100000)
        solve_c(test=True, n=5, h_list=[1, 2, 1, 1, 3])
        solve_c(test=True, n=4, h_list=[1, 3, 2, 1])
        solve_c(test=True, n=5, h_list=[1, 2, 3, 4, 5])
        solve_c(test=True, n=1, h_list=[1000000000])
    else:
        # solve_a()
        solve_b()
        # solve_c()

Submission status: Accepted

Solution code:
N = int(input())

c = 0

for i in range(6):
    if N >= 10 ** i:
        if i % 2 == 1:
            c += 9 * (10 ** (i - 1))
    else:
        if i % 2 == 1:
            c += N - (10 ** (i - 1)) + 1
        break

print(c)

Submission status: Accepted

Solution code:
num = int(input())

result = 0

def is_odd(number):
    if not number % 2 == 0:
        return True
    else:
        return False

ketasu = len(str(num))
ruizyo = ketasu - 1

if is_odd(ketasu):
  result += (num+1-10**ruizyo)

for i in range(1,10,2):
  if i > ruizyo:
    break
  result += (10**(i))-(10**(i-1))

print(result)

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(1, n + 1):
    if i < 10:
        cnt += 1
    elif 99 < i and i < 1000:
        cnt += 1
    elif 9999 < i and i < 100000:
        cnt += 1
        
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
n2 = n
cnt = 0
while n>0:
	cnt += 1
	n = n // 10
if cnt == 1:
	print(n2)
elif cnt == 2:
	print(9)
elif cnt == 3:
	print(9 + (n2-100+1))
elif cnt == 4:
	print(9 + 900)
elif cnt == 5:
	print(9 + 900 + (n2-10000+1))
elif cnt == 6:
	print(9 + 900 + 90000)

Submission status: Accepted

Solution code:
N = int(input())
s = str(N)
count = 0
if len(s) == 1:
    count += N
    print(count)
elif 1 < len(s) < 3:
    count += 9
    print(count)
elif len(s) == 3:
    count += 9
    count += N-99
    print(count)
elif 3 < len(s) < 5:
    count += 9 + 900
    print(count)
elif len(s) == 5:
    count += 9 + 900 + N-9999
    print(count)
elif len(s) > 5:
    count += 90909
    print(count)

Submission status: Accepted

Solution code:
N= input()
 
n= int(N)
first = 9
sencond = 900
thrid = 90000
sum =0
if  len(N) ==1 :
    sum = n
elif len(N) ==2 :
    sum = first 
elif len(N) ==3 :
    sum = first + (n- 99)
elif len(N) ==4 :
    sum = first + sencond
elif len(N) ==5 :
    sum = first +  sencond + (n- 9999) 
elif len(N) ==6 :
    sum = first +  sencond + thrid
print(sum)

Submission status: Accepted

Solution code:
N = input()

if len(N) % 2 == 0:
    C = len(N) - 1
    if C == 5:
        print('90909')
    elif C == 3:
        print('909')
    elif C == 1:
        print('9')

elif len(N) % 2 == 1:
    if len(N) == 5:
        C = int(N) - 9999
        print(C+909)
    elif len(N) == 3:
        C = int(N) - 99
        print(C+9)
    elif len(N) == 1:
        print(N)

Submission status: Accepted

Solution code:
N = int(input())
if N < 10:
    l = range(N)
else:
    l = range(1, N + 1)

counter = 0
for s in l:
    n = len(str(s))
    if n % 2 == 1:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
import sys
# import bisect
# import math
# import numpy as np

# from fractions import gcd
# import itertools

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def make_divisors(n):
    # divisors = []
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            # divisors.append(i)
            return i
            # if i != n // i:
            #     divisors.append(n//i)


def n_to_10(X, n):
    if int(X / n):
        return n_to_10(int(X / n), n) + str(X % n)
    return str(X % n)


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()
    """この下から書いてね"""
    n = int(input())
    ans = 0
    for i in range(n):
        i += 1
        memo = str(i)
        if len(memo) % 2 == 1:
            ans += 1
    print(ans)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
r =0
def keta(n):
  c=0
  while 10**c<=n+1:
    c=c+1
  return(c)
  
for i in range(N):
  if keta(i) % 2 == 1:
    r=r+1
    
print(r)

Submission status: Accepted

Solution code:
n = input()

l = len(n)

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

if l % 2 == 0:
    print(ans)
else:
    ans += (int(n[0]) - 1) * j
    if l != 1:
        ans += int(n[1:]) + 1
    else:
        ans += 1
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
n = int(input())
dig = math.log10(n)
if dig<1:
    print(n)
elif 1 <= dig and dig < 2:
    print(9)
elif 2 <= dig and dig < 3:
    print(9+n-99)
elif 3 <= dig and dig < 4:
    print(9+999-99)
elif 4 <= dig and dig < 5:
    print(9+999-99+n-9999)
else:
    print(9+999-99+99999-9999)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())


for i in range(6):
    if 0 < n // 10 ** i < 10:
        k = i
        break
count = 0
if k % 2 == 0:
    while k >= 0:
        count += n - 10 ** k + 1
        k -= 2
        n = 10 ** (k + 1) - 1
elif k % 2 == 1:
    k -= 1
    n = 10 ** (k + 1) - 1
    while k >= 0:
        count += n - 10 ** k + 1
        k -= 2
        n = 10 ** (k + 1) - 1

print(count)

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

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())
#1 - 9                  9
#100 - 999              900
#10000 - 99999          90000

#10 - 99                90
#1000 - 9999            9000

if N == 100000:
    print("90909")
elif N > 9999:
    print(N - 9090)
elif N > 999:
    print("909")
elif N > 99:
    print(N - 90)
elif N > 9:
    print("9")
else:
    print(N)

Submission status: Accepted

Solution code:
n = int(input())
s = 0
for i in range(1, 6, 2):
  if n >= 10 ** i:
    s += 9 * (10 ** (i - 1))
  else:
    tmp = n - (10 ** (i - 1)) + 1
    if tmp > 0:
      s += tmp
    break
print(s)

Submission status: Accepted

Solution code:
def calc(N):
    result = 0
    i = 1
    while (True):
        if (N >= i * 10):
            result += 9 * i
        else:
            result += max(0, N - i + 1)
            return result
        i *= 100

N = int(input())
print(calc(N))

Submission status: Accepted

Solution code:
import math

N = int(input())
cnt = 0

for i in range(1, N+1):
  if ((math.floor(math.log10(i))+1) %2 ==1):
    cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

if N <= 9:
  print(N)
else:
  for i in range(1, N+1, 1):
    i_str = str(i)
    if (len(i_str)%2) != 0:
        count = count + 1
  print(count)

Submission status: Accepted

Solution code:
N = int(input())

import math
order = int(math.log10(int(N)))
ans = 0

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0

if N >= 10:
    count += 9
else:
    count += N

if N < 100:
    print(count)
    exit(0)

if N >= 1000:
    count += 1000 - 100
else:
    count += N - 99
    print(count)
    exit(0)

if N < 10000:
    print(count)
    exit(0)

if N >= 100000:
    count += 100000 - 10000
else:
    count += N - 9999

print(count)
exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = int(input())

dig_max = math.floor(math.log10(n))

num = 0
for i in range(0, dig_max, 2):
    num += 9 * (10**i)

if dig_max % 2 == 0:
    num += n - 10**dig_max + 1

print(num)

Submission status: Accepted

Solution code:

N = int(input())
"""
N = 100
"""
N_digits = len(str(N))

ans = 0
if N_digits % 2 == 0:
    for i in range(0,int(N_digits/2)):
        ans += 9*10**(2*i)

else:
    for i in range(0,int((N_digits-1)/2)):
        ans += 9*10**(2*i)
    ans += N - 10**(N_digits-1) + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

if(n < 10):
    ans = n
elif(10 <= n and n < 100):
    ans = 9
elif(100 <= n and n < 1000):
    ans = (n - 90)
elif(1000 <= n and n < 10000):
    ans = 909
elif(10000 <= n and n < 100000):
    ans = (n-9090)
else:
    ans = 90909

print(ans)

Submission status: Accepted

Solution code:
N = int(input())

count = 0
i = 0
while True:
    if N >= 10 ** i:
        count += min(N, 10 ** (i + 1) - 1) - 10 ** i + 1
        i += 2
    else:
        break

print(count)