結果

問題 No.707 書道
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-12-09 16:51:25
言語 Haskell
(9.8.2)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 158,056 KB
実行使用メモリ 8,304 KB
最終ジャッジ日時 2023-10-14 14:25:11
合計ジャッジ時間 1,561 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,484 KB
testcase_01 AC 3 ms
7,552 KB
testcase_02 AC 2 ms
7,872 KB
testcase_03 AC 2 ms
7,464 KB
testcase_04 AC 2 ms
7,308 KB
testcase_05 AC 4 ms
8,020 KB
testcase_06 AC 4 ms
8,160 KB
testcase_07 AC 5 ms
8,304 KB
testcase_08 AC 2 ms
7,552 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+1)],x<-[0..(w+1)],y==0||y==h+1||x==0||x==w+1]
       printf "%.8f" $ minimum anss
0