結果

問題 No.1143 面積Nの三角形
ユーザー shakayamishakayami
提出日時 2021-06-01 23:53:33
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 867 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 83,868 KB
最終ジャッジ日時 2024-04-26 09:56:32
合計ジャッジ時間 5,248 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,472 KB
testcase_01 AC 52 ms
60,032 KB
testcase_02 AC 60 ms
63,872 KB
testcase_03 AC 66 ms
70,912 KB
testcase_04 AC 53 ms
61,568 KB
testcase_05 AC 64 ms
72,064 KB
testcase_06 AC 101 ms
75,520 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))

            
0