結果
問題 | No.707 書道 |
ユーザー | kotatsugame |
提出日時 | 2018-06-29 22:27:51 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 469 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 77,916 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-13 15:20:35 |
合計ジャッジ時間 | 1,239 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 3 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 5 ms
4,376 KB |
testcase_06 | AC | 6 ms
4,376 KB |
testcase_07 | AC | 7 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,380 KB |
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-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; }