結果
問題 | No.2871 Universal Serial Bus |
ユーザー | ID 21712 |
提出日時 | 2024-11-03 22:38:05 |
言語 | Go (1.23.4) |
結果 |
TLE
|
実行時間 | - |
コード長 | 768 bytes |
コンパイル時間 | 14,189 ms |
コンパイル使用メモリ | 242,304 KB |
実行使用メモリ | 15,444 KB |
最終ジャッジ日時 | 2024-11-03 22:38:23 |
合計ジャッジ時間 | 16,080 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 TLE * 1 |
ソースコード
package main import . "fmt" import . "strings" import . "math/big" func main() { var h,w int Scan(&h,&w) ss:=make([]string,h) for i:=range ss { var s string Scan(&s) s=ReplaceAll(s,".","a") s=ReplaceAll(s,"#",".") ss[i]=ReplaceAll(s,"a","#") } var x,y int for i,s:=range ss { var t string Scan(&t) if s!=t { x++ } if ss[h-1-i]!=t { y++ } } if x>0&&y>0 { Println(-1) } else if x==0&&y>0 { Println("3.5317401904617327") } else { var e,f,z *Rat e,f,z=NewRat(2,1),NewRat(1,1),NewRat(0,1) for i:=0;i<1000;i++ { e.Mul(e,NewRat(1,2)) if i%2==0 &&x>0{ continue } z.Add(z,new(Rat).Mul(NewRat(int64(i+1),1), new(Rat).Mul(f,new(Rat).Sub(NewRat(1,1),e)))) f.Mul(f,e) } Println(z.FloatString(12)) } }