3431. skew数

摘要
Title: 3431. skew数
Tag: 模拟
Memory Limit: 64 MB
Time Limit: 1000 ms

Powered by:NEFU AB-IN

Link

3431. skew数

  • 题意

  • 思路

    模拟输出即可

  • 代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    # 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)

使用搜索:谷歌必应百度