結果
問題 | No.707 書道 |
ユーザー |
|
提出日時 | 2018-07-26 16:06:04 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 03:19:36 |
合計ジャッジ時間 | 980 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
#yuki707import mathh,w=map(int,raw_input().split())p=[]q=[]for i in xrange(h):p.append(raw_input())for i in xrange(h):for j in xrange(w):if p[i][j]=='1':q.append((i+1,j+1))res=float('inf')for i in xrange(h+2):cols=range(1,w+1) if i==0 or i==h+1 else [0,w+1]for j in cols:temp=0for x,y in q:temp+=math.sqrt((i-x)**2+(j-y)**2)res=min(res,temp)print "%.9f" % res