- Quiz
- C - Sqrt Inequality
- https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_c
- 誤差に厳しい。C++のlong doubleだと通らない。EPS足せばEPSの値によっては通る
- pythonのdecimalで殴ってみる
- AC https://atcoder.jp/contests/panasonic2020/submissions/20430948
- 試行錯誤した
- 精度指定は不要。10000を指定したらTLE, 2000だとギリギリ間に合うがWA, 指定しなければAC
- sqrt取る時はmath.sqrtを使ってはいけない。decimalがそれに対応するものを持っているのでそれを使う
a,b,c = map(int, input().split()) import decimal from decimal import * import math # 不要 # decimal.getcontext().prec = 2000 A = Decimal(a) B = Decimal(b) C = Decimal(c) # こういうルートのとり方もある root = Decimal("0.5") # if math.sqrt(A)+math.sqrt(B)<math.sqrt(C): # WA if A.sqrt()+B.sqrt()<C.sqrt(): # AC # if (A**root)+(B**root)<(C**root): # AC print("Yes") else: print("No")
他の殴れた例
- 020-Log Inequality(★3)
- AC https://atcoder.jp/contests/typical90/submissions/21925006
- C++ long doubleではWA