結果
| 問題 | 
                            No.888 約数の総和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-11-25 13:59:57 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 135 ms / 2,000 ms | 
| コード長 | 555 bytes | 
| コンパイル時間 | 105 ms | 
| コンパイル使用メモリ | 12,416 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-10-01 22:09:42 | 
| 合計ジャッジ時間 | 3,305 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
from math import sqrt, floor
def calc_positive_divisors(num: int) -> list[int]:
    small_divisors = []
    large_divisors = []
    for n in range(1, floor(sqrt(num))+1):
        if num % n == 0:
            small_divisors.append(n)
            large_divisors.append(num//n)
    if small_divisors[-1] == large_divisors[-1]:
        large_divisors.pop()
    divisors = small_divisors + list(reversed(large_divisors))
    return divisors
def main():
    N = int(input())
    print(sum(calc_positive_divisors(N)))
if __name__ == "__main__":
    main()