結果

問題 No.2358 xy+yz+zx=N
ユーザー miho-4miho-4
提出日時 2023-06-23 22:59:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 581 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 86,156 KB
最終ジャッジ日時 2023-09-14 10:14:54
合計ジャッジ時間 4,219 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,260 KB
testcase_01 AC 73 ms
71,340 KB
testcase_02 AC 73 ms
71,168 KB
testcase_03 WA -
testcase_04 AC 77 ms
71,360 KB
testcase_05 WA -
testcase_06 AC 75 ms
71,272 KB
testcase_07 WA -
testcase_08 AC 308 ms
85,424 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 249 ms
78,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ans=set()
#x=y=z
i=0
while 3*(i**2)<=n:
  if 3*(i**2)==n:
    ans.add((i,i,i))
  i+=1
#x=y<z
i=1
while i*2<=n:
  if (n-i**2)%(2*i)==0 and i<(n-i**2)//(2*i):
    z=(n-i**2)//(2*i)
    ans.add((i,i,z))
    ans.add((i,z,i))
    ans.add((z,i,i))
  i+=1
#x<y<z
x=0
while 3*x**2<=n:
  y=x+1
  while 2*x*y+y*y<=n:
    z=(n-x*y)//(x+y)
    if (n-x*y)%(x+y)==0 and y<z:
      ans.add((x,y,z))
      ans.add((x,z,y))
      ans.add((y,x,z))
      ans.add((y,z,x))
      ans.add((z,x,y))
      ans.add((z,y,x))
    y+=1
  x+=1
  
print(len(ans))
for x,y,z in ans:
  print(x,y,z)
0