from copy import deepcopy
n =int(input())
maxn =int(5e6)+10
dic =dict()for a inrange(maxn):if a * a > n:breakfor b inrange(a,maxn):if a * a + b * b > n:breakif dic.get(a*a+b*b)isNone:dic[a*a+b*b]=(a,b)
ans =[maxn for _ inrange(4)]for a insorted(dic.keys()):b = n - aif a > b:breakif b in dic.keys():tmp =list(dic[a]+dic[b])tmp.sort()for i inrange(4):if tmp[i]!= ans[i]:if tmp[i]< ans[i]:ans = deepcopy(tmp)breakfor i inrange(3):print(ans[i], end =' ')print(ans[-1])作者:波尔k
链接:https://www.acwing.com/activity/content/code/content/8139085/
来源:AcWing
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。