結果

問題 No.2480 Sequence Sum
ユーザー mattu34mattu34
提出日時 2023-11-20 15:10:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 55 ms / 500 ms
コード長 3,447 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 63,924 KB
最終ジャッジ日時 2023-11-20 15:10:07
合計ジャッジ時間 3,631 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
57,796 KB
testcase_01 AC 47 ms
57,796 KB
testcase_02 AC 51 ms
61,508 KB
testcase_03 AC 50 ms
61,508 KB
testcase_04 AC 50 ms
61,508 KB
testcase_05 AC 50 ms
61,508 KB
testcase_06 AC 51 ms
61,508 KB
testcase_07 AC 51 ms
61,508 KB
testcase_08 AC 51 ms
61,508 KB
testcase_09 AC 52 ms
61,508 KB
testcase_10 AC 50 ms
61,508 KB
testcase_11 AC 50 ms
61,508 KB
testcase_12 AC 51 ms
61,508 KB
testcase_13 AC 51 ms
61,508 KB
testcase_14 AC 55 ms
63,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 約数列挙
def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i * i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n // i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


# 素因数分解(辞書)
def prime_factorize(n):
    V = defaultdict(int)
    i = 2
    while i**2 <= n:
        while n % i == 0:
            V[i] += 1
            n //= i
        i += 1
    if n != 1:
        V[n] += 1
    return V


def convert_90(matrix):
    # 入力行列の行数と列数を取得
    rows = len(matrix)
    cols = len(matrix[0])

    # 90度回転後の行列を初期化
    rotated_matrix = [[0] * rows for _ in range(cols)]

    # 元の行列を90度回転させて新しい行列に格納
    for i in range(rows):
        for j in range(cols):
            rotated_matrix[j][rows - 1 - i] = matrix[i][j]

    return rotated_matrix


def cropping(MAP, mark):
    M_y, M_x = 0, 0
    m_y, m_x = INF, INF
    H, W = len(MAP), len(MAP[0])
    for i in range(H):
        for j in range(W):
            if MAP[i][j] == mark:
                M_y = max(i, M_y)
                M_x = max(M_x, j)
                m_y = min(i, m_y)
                m_x = min(m_x, j)
    new = [[0] * (M_x - m_x + 1) for _ in range(M_y - m_y + 1)]
    for i in range(m_y, M_y + 1):
        for j in range(m_x, M_x + 1):
            new[i - m_y][j - m_x] = MAP[i][j]
    return new


def cos(theta):
    theta_rad = math.radians(theta)
    cos_value = math.cos(theta_rad)
    return cos_value

    return math.acos(val)


def sin(theta):
    theta_rad = math.radians(theta)
    sin_value = math.sin(theta_rad)
    return sin_value


def acos(value):
    radians = math.acos(value)
    degrees = math.degrees(radians)
    return degrees


# ベクトルABとベクトルBCの外積(マイナス→ BCはABから見て右側、プラス→ BCはABから見て左側)
def cross_product(A, B, C, D):
    return (B[0] - A[0]) * (C[1] - B[1]) - (B[1] - A[1]) * (C[0] - B[0])


# ダブリング dp[i][j]:=jから2**i回遷移したときの到達点
# https://atcoder.jp/contests/abc167/submissions/40815296
# N,K=map(int,input().split())
# A=list(map(int,input().split()))
# dp=[[-1]*N for _ in range(60)]
# for j in range(N):
#     dp[0][j]=A[j]-1
# for i in range(1,60):
#     for j in range(N):
#         dp[i][j]=dp[i-1][dp[i-1][j]]
# i=0
# now=0
# while(K>0):
#     if (K&1)==1:
#         now=dp[i][now]
#     i+=1
#     K>>=1
# print(now+1)

# 牛ゲー
# xj-xi<=bkの条件の下で、xt-xsを最大化する問題
# i→jへ、重みbkの有効辺をはったとき、sからtまでの最短距離がxt-xsの最大値と一致する。
# 到達できない場合は、xt-xsは無限大

from collections import *
import sys
import heapq
import bisect
import itertools
from functools import lru_cache
import math

# sys.setrecursionlimit(int(1e7))

dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0))
dxdy2 = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1))
dxdy3 = ((0, 1), (1, 0))
dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1))
INF = float("inf")
MOD = 998244353
mod = 998244353
MOD2 = 10**9 + 7
mod2 = 10**9 + 7
# memo : len([a,b,...,z])==26

input = lambda: sys.stdin.readline().rstrip()
mi = lambda: map(int, input().split())
li = lambda: list(mi())


N = int(input())
yaku = make_divisors(N)
print(N - len(yaku))
0