結果

問題 No.707 書道
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-12-09 16:49:12
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 161,060 KB
実行使用メモリ 8,292 KB
最終ジャッジ日時 2023-10-14 14:24:53
合計ジャッジ時間 1,627 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,560 KB
testcase_01 AC 2 ms
7,560 KB
testcase_02 AC 3 ms
7,804 KB
testcase_03 AC 2 ms
7,560 KB
testcase_04 AC 2 ms
7,336 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
7,608 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

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],x<-[0..w],y==0||y==h+1||x==0||x==w+1]
       printf "%.7f" $ minimum anss
0