結果

問題 No.2358 xy+yz+zx=N
ユーザー AmGinE_8AmGinE_8
提出日時 2023-06-24 00:10:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,778 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 13,016 KB
最終ジャッジ日時 2023-09-14 10:17:08
合計ジャッジ時間 9,617 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,876 KB
testcase_01 AC 17 ms
8,080 KB
testcase_02 AC 17 ms
7,952 KB
testcase_03 AC 16 ms
7,964 KB
testcase_04 AC 16 ms
8,016 KB
testcase_05 AC 16 ms
7,904 KB
testcase_06 AC 17 ms
7,880 KB
testcase_07 AC 25 ms
8,756 KB
testcase_08 AC 1,778 ms
12,796 KB
testcase_09 AC 1,737 ms
13,016 KB
testcase_10 AC 1,740 ms
9,868 KB
testcase_11 AC 1,675 ms
10,180 KB
testcase_12 AC 1,339 ms
9,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import isqrt

n=int(input())
x,y=0,1
ans=set()
while x<=isqrt(int(n/3))+1:
  while y**2<=n:
    if (n-(x*y))%(x+y)==0:
      z=(n-(x*y))//(x+y)
      if 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
  y=x
print(len(ans))
for i in ans:
    print(i[0],i[1],i[2])
0