結果
| 問題 |
No.707 書道
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-29 22:27:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 469 bytes |
| コンパイル時間 | 682 ms |
| コンパイル使用メモリ | 78,216 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 23:56:29 |
| 合計ジャッジ時間 | 1,199 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
ソースコード
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
int h,w;
string p[50];
main()
{
cin>>h>>w;
for(int i=0;i<h;i++)cin>>p[i];
double ans=1e9;
for(int i=-1;i<=h;i++)for(int j=-1;j<=w;j++)
{
if(!((i==-1||i==h)^(j==-1||j==w)))continue;
double now=0;
for(int x=0;x<h;x++)for(int y=0;y<w;y++)
{
if(p[x][y]=='0')continue;
now+=hypot(i-x,j-y);
}
ans=min(ans,now);
}
cout<<fixed<<setprecision(9)<<ans<<endl;
}