結果

問題 No.2555 Intriguing Triangle
ユーザー iseeisee
提出日時 2023-12-01 00:53:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 1,225 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 89,484 KB
最終ジャッジ日時 2023-12-01 13:40:09
合計ジャッジ時間 6,303 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
87,564 KB
testcase_01 AC 159 ms
88,204 KB
testcase_02 AC 145 ms
87,692 KB
testcase_03 AC 158 ms
88,588 KB
testcase_04 AC 181 ms
88,844 KB
testcase_05 AC 135 ms
87,692 KB
testcase_06 AC 137 ms
87,692 KB
testcase_07 AC 139 ms
87,692 KB
testcase_08 AC 136 ms
87,692 KB
testcase_09 AC 159 ms
88,588 KB
testcase_10 AC 213 ms
89,100 KB
testcase_11 AC 167 ms
88,716 KB
testcase_12 AC 255 ms
89,484 KB
testcase_13 AC 183 ms
88,972 KB
testcase_14 AC 218 ms
88,972 KB
testcase_15 AC 153 ms
88,204 KB
testcase_16 AC 167 ms
88,716 KB
testcase_17 AC 136 ms
87,564 KB
testcase_18 AC 178 ms
88,844 KB
testcase_19 AC 140 ms
87,692 KB
testcase_20 AC 138 ms
87,692 KB
testcase_21 AC 338 ms
89,484 KB
testcase_22 AC 142 ms
87,692 KB
testcase_23 AC 139 ms
87,692 KB
testcase_24 AC 140 ms
87,692 KB
testcase_25 AC 139 ms
87,692 KB
testcase_26 AC 152 ms
88,204 KB
testcase_27 AC 166 ms
88,588 KB
testcase_28 AC 139 ms
87,820 KB
testcase_29 AC 170 ms
88,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()

from fractions import Fraction

def main():
    # 入力
    a = int(input())
    b = int(input())
    c = int(input())
    # 計算・出力
    for BD in range(1, b+c+1):
        for EC in range(1, b+c+1):
            BC = BD + a + EC
            if b + c > BC and BC + b > c and c + BC > b:
                # cosB = - (c**2 - BC**2 - b**2) / (2*b*BC)
                # AD = sqrt(BD**2 + b**2 - 2*BD*b*cosB)
                # cosBAD = (BD**2 - b**2 - AD**2) / (2*b*AD)
                cosB = Fraction(-(c**2 - BC**2 - b**2), (2*b*BC))
                AD2 = (BD**2 + b**2 - 2*BD*b*cosB)
                cos2BAD = (BD**2 - b**2 - AD2)**2 / (4*b*b*AD2)

                # cosC = - (b**2 - BC**2 - c**2) / (2*c*BC)
                # AE = sqrt(EC**2 + c**2 - 2*EC*c*cosC)
                # cosEAC = (EC**2 - c**2 - AE**2) / (2*c*AE)
                cosC = Fraction(- (b**2 - BC**2 - c**2), (2*c*BC))
                AE2 = (EC**2 + c**2 - 2*EC*c*cosC)
                cos2EAC = (EC**2 - c**2 - AE2)**2 / (4*c*c*AE2)

                if cos2BAD == cos2EAC:
                    print('Yes')
                    return
    print('No')

if __name__ == "__main__":
    main()
0