結果
問題 |
No.1143 面積Nの三角形
|
ユーザー |
![]() |
提出日時 | 2021-06-01 23:53:33 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 867 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,428 KB |
実行使用メモリ | 83,224 KB |
最終ジャッジ日時 | 2024-11-09 00:23:05 |
合計ジャッジ時間 | 5,238 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 -- * 1 |
other | AC * 6 TLE * 3 -- * 9 |
ソースコード
def is_square(M): low=0 high=M+10 while(high-low>1): mid=(high+low)//2 if mid*mid<=M: low=mid else: high=mid if low*low==M: return low else: return None N=int(input()) D={N} for i in range(1,N+1): if (N*N)%i==0: D.add(i) ans=set() for x in D: for y in D: ''' xyz(x+y+z)=N*N xy z*z+(x+y)xy*z-N*N=0 ''' A=x*y B=(x+y)*x*y C=-N*N DD=B*B-4*A*C SD=is_square(DD) if not(SD==None): if (-B-SD)%(2*A)==0: z=(-B-SD)//(2*A) if z>0: ans.add(tuple(sorted([x,y,z]))) if (-B+SD)%(2*A)==0: z=(-B+SD)//(2*A) if z>0: ans.add(tuple(sorted([x,y,z]))) print(len(ans))