結果
問題 | No.306 さいたま2008 |
ユーザー |
![]() |
提出日時 | 2025-02-14 12:38:56 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 691 bytes |
コンパイル時間 | 13,831 ms |
コンパイル使用メモリ | 243,148 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-14 12:39:30 |
合計ジャッジ時間 | 31,942 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 4 |
ソースコード
package mainimport . "fmt"import . "math"import "math/rand"func main() {var xa,ya,xb,yb float64Scan(&xa,&ya,&xb,&yb)var mind float64 = 1e9var ans float64for i := 0; i < 1e7; i++ {yp := rand.Float64()*Abs(ya-yb)+Min(ya,yb)d := Hypot(xa,ya-yp)+Hypot(xb,yb-yp)if d < mind {ans,mind = yp,d}}for i := 0; i < 1e7; i++ {yp := ans*(float64(i)/1e8+0.95)d := Hypot(xa,ya-yp)+Hypot(xb,yb-yp)if d < mind {ans,mind = yp,d}}aa:=0.0cc:=0.0for i := 0; i < 1e7; i++ {yp := ans*(rand.Float64()*0.001+0.9995)//d := Hypot(xa,ya-yp)+Hypot(xb,yb-yp)if Abs(yp-ans)/ans<1e5 {aa+=ypcc+=1}}if cc>0 {ans=aa/cc}Println(ans)}