結果
問題 | No.278 連続する整数の和(2) |
ユーザー |
![]() |
提出日時 | 2022-09-22 11:03:38 |
言語 | Python3 (3.10.1 + numpy 1.22.3 + scipy 1.8.0) |
結果 |
AC
|
実行時間 | 619 ms / 2,000 ms |
コード長 | 1,054 bytes |
コンパイル時間 | 61 ms |
使用メモリ | 9,804 KB |
最終ジャッジ日時 | 2023-01-11 13:26:43 |
合計ジャッジ時間 | 6,101 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
9,636 KB |
testcase_01 | AC | 31 ms
9,512 KB |
testcase_02 | AC | 523 ms
9,804 KB |
testcase_03 | AC | 31 ms
9,624 KB |
testcase_04 | AC | 31 ms
9,692 KB |
testcase_05 | AC | 38 ms
9,512 KB |
testcase_06 | AC | 44 ms
9,596 KB |
testcase_07 | AC | 44 ms
9,776 KB |
testcase_08 | AC | 490 ms
9,748 KB |
testcase_09 | AC | 505 ms
9,604 KB |
testcase_10 | AC | 619 ms
9,508 KB |
testcase_11 | AC | 475 ms
9,620 KB |
testcase_12 | AC | 31 ms
9,648 KB |
testcase_13 | AC | 407 ms
9,756 KB |
testcase_14 | AC | 325 ms
9,512 KB |
testcase_15 | AC | 356 ms
9,524 KB |
testcase_16 | AC | 285 ms
9,648 KB |
testcase_17 | AC | 505 ms
9,676 KB |
ソースコード
import bisect import copy import decimal import fractions import heapq import itertools import math import random import sys import time from collections import Counter,deque,defaultdict from functools import lru_cache,reduce from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max def _heappush_max(heap,item): heap.append(item) heapq._siftdown_max(heap, 0, len(heap)-1) def _heappushpop_max(heap, item): if heap and item < heap[0]: item, heap[0] = heap[0], item heapq._siftup_max(heap, 0) return item from math import gcd as GCD read=sys.stdin.read readline=sys.stdin.readline readlines=sys.stdin.readlines write=sys.stdout.write def Divisors(N): divisors=[] for i in range(1,N+1): if i**2>=N: break elif N%i==0: divisors.append(i) if i**2==N: divisors+=[i]+[N//i for i in divisors[::-1]] else: divisors+=[N//i for i in divisors[::-1]] return divisors N=int(readline()) ans=sum(Divisors(GCD(N,N*(N-1)//2))) print(ans)