結果

問題 No.1006 Share an Integer
コンテスト
ユーザー convexineq
提出日時 2020-03-06 21:44:11
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 451 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 186 ms
コンパイル使用メモリ 85,504 KB
実行使用メモリ 95,872 KB
最終ジャッジ日時 2026-05-01 15:14:00
合計ジャッジ時間 3,897 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

# coding: utf-8
# Your code here!

import sys
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())

yaku = [1]*(n+1)
for i in range(2,n+1):
    for j in range(i,n+1,i):
        yaku[j] += 1


val = 1000000000
res = []
for i in range(1,n):
    v = i-yaku[i]-(n-i)+yaku[n-i]
    if v < 0: v = -v
    if v < val:
        val = v
        res = [i]
    elif v==val:
        res.append(i)

#print(res)    
for i in res:
    print(i,n-i)



0