結果
| 問題 | No.1006 Share an Integer |
| コンテスト | |
| ユーザー |
komkompi
|
| 提出日時 | 2020-03-22 17:01:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 617 bytes |
| 記録 | |
| コンパイル時間 | 907 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 163,192 KB |
| 最終ジャッジ日時 | 2024-12-24 20:36:08 |
| 合計ジャッジ時間 | 35,377 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 RE * 1 TLE * 11 |
ソースコード
# coding: utf-8
# Your code here!
def count(num):
N=int(num**0.5)//1
count=0
for i in range(1,N+1):
if num/i==num//i:
count+=2
if num**0.5==N:
count-=1
return count
X=int(input())
A=X//2
ans=[]
for a in range(1,A+1):
b=X-a
fa=a-count(a)
fb=b-count(b)
score=abs(fa-fb)
ans.append([score,a,b])
ans.append([score,b,a])
ans.sort(key=lambda x: x[1])
ans.sort(key=lambda x: x[0])
base=ans[0][0]
index=0
while ans[index][0]==base:
print(ans[index][1],ans[index][2])
if ans[index]==ans[index+1]:
index+=1
index+=1
komkompi