結果
| 問題 | No.1006 Share an Integer |
| コンテスト | |
| ユーザー |
Novi
|
| 提出日時 | 2020-05-07 02:27:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 561 bytes |
| 記録 | |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 17,824 KB |
| 最終ジャッジ日時 | 2024-07-03 09:14:52 |
| 合計ジャッジ時間 | 4,279 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 TLE * 1 -- * 10 |
ソースコード
x=int(input())
#約数列挙
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort()
return divisors
def f(a):
return a-len(make_divisors(a))
ans=float("inf")
cnt=[]
check=ans
for i in range(1,x+1):
tmp=abs(f(i)-f(x-i))
if ans>=tmp:
cnt.append(i)
ans=tmp
check=min(check,tmp)
for i in cnt:
if abs(f(i)-f(x-i))==check and i>0 and x-i>0:
print(i,x-i)
Novi