3431. número sesgado

Impulsado por: NEFU AB-IN

Enlace

3431. número sesgado

  • significado del titulo

    levemente

  • tren de pensamiento

    La salida analógica está bien

  • el código

    # import
    import sys, math, os
    from io import BytesIO, IOBase
    from collections import Counter, deque
    from heapq import heapify, heappop, heappush, nlargest, nsmallest
    from bisect import bisect_left, bisect_right
    from datetime import datetime, timedelta
    from typing import *
    
    
    class sa:
        def __init__(self, x, y):
            self.x = x
            self.y = y
    
        def __lt__(self, x):
            pass
    
    
    # Final
    N = int(1e3 + 10)
    INF = int(2e9)
    
    # Define
    sys.setrecursionlimit(INF)
    read = lambda: map(int, input().split())
    
    # —————————————————————Division line ——————————————————————
    
    while True:
        try:
            s = input()
            ans = 0
            for i in range(len(s)):
                ans += int(s[i]) * (2 ** (len(s) - i) - 1)
            print(ans)
        except:
            exit(0)
    
    

Supongo que te gusta

Origin blog.csdn.net/qq_45859188/article/details/130231729
Recomendado
Clasificación