結果
| 問題 |
No.707 書道
|
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-12-09 16:51:25 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 651 bytes |
| コンパイル時間 | 1,561 ms |
| コンパイル使用メモリ | 173,560 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-16 09:02:04 |
| 合計ジャッジ時間 | 2,117 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Data.List
import Text.Printf
g::Double->Double->String->[(Double,Double)]
g _ _ ""=[]
g h w ('0':xs)= g h (w+1) xs
g h w (_:xs) =(h,w):(g h (w+1) xs)
f::Double->[String]->[(Double,Double)]
f _ []=[]
f h (x:xs)=(g h 1 x) ++ (f (h+1) xs)
f2::Double->Double->(Double,Double)->Double
f2 h w (y,x)=sqrt((y-h)*(y-h)+(x-w)*(x-w))
main = do
e<-getLine
es<-getContents
let ts=lines es
ds=f 1 ts
(h:w:[])=map read (words e)::[Int]
anss=[sum(map (f2 (fromIntegral y::Double) (fromIntegral(x)::Double)) ds)|y<-[0..(h+1)],x<-[0..(w+1)],y==0||y==h+1||x==0||x==w+1]
printf "%.8f" $ minimum anss
horiesiniti