結果
| 問題 | No.707 書道 |
| コンテスト | |
| ユーザー |
horiesiniti
|
| 提出日時 | 2018-12-09 16:51:25 |
| 言語 | Haskell (9.14.1) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 651 bytes |
| 記録 | |
| コンパイル時間 | 1,156 ms |
| コンパイル使用メモリ | 192,256 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2026-04-05 14:04:23 |
| 合計ジャッジ時間 | 1,566 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/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