結果
| 問題 |
No.306 さいたま2008
|
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2015-11-27 22:55:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 732 bytes |
| コンパイル時間 | 693 ms |
| コンパイル使用メモリ | 78,312 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 00:13:30 |
| 合計ジャッジ時間 | 1,674 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:46: warning: ‘pos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
32 | for( double y = pos - 0.01; y <= pos + 0.01; y += 1e-7 ){
| ~~~~^~~~~~
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
int main()
{
double x1, y1;
double x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
double pos, mind = 114514;
for( double y = min(y1, y2); y <= max(y1, y2); y += 1e-3 ){
double d = hypot(x1, y1 - y) + hypot(x2, y2 - y);
if( d < mind ){
mind = d;
pos = y;
}
}
for( double y = pos - 0.01; y <= pos + 0.01; y += 1e-7 ){
double d = hypot(x1, y1 - y) + hypot(x2, y2 - y);
if( d < mind ){
mind = d;
pos = y;
}
}
printf("%.12f\n", pos);
return 0;
}
startcpp