結果
| 問題 |
No.306 さいたま2008
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2017-10-22 13:50:17 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,277 bytes |
| コンパイル時間 | 705 ms |
| コンパイル使用メモリ | 79,528 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-21 13:45:11 |
| 合計ジャッジ時間 | 1,482 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 16 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:37:45: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
37 | double dist2 = sqrt( xa*xa + (ya-y)*(ya-y2) ) + sqrt( xb*xb + (yb-y2)*(yb-y2) );
| ~~~^~~
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
double X[12] = { 100, 10, 1, 0.1, 0.01, 0.001, 0.0001, 0.00001, 0.000001, 0.0000001, 0.00000001, 0.000000001 };
double xa,ya,xb,yb;
cin >> xa >> ya >> xb >> yb;
double ans = 0;
for ( int i = 0; i < 12; i++ ) {
double dist;
double y;
dist = 1000000;
for ( int j = 0; j < 10; j++ ) {
double y1 = ans + X[i]*j;
double y2 = ans - X[i]*j;
double dist1 = sqrt( xa*xa + (ya-y1)*(ya-y1) ) + sqrt( xb*xb + (yb-y1)*(yb-y1) );
double dist2 = sqrt( xa*xa + (ya-y)*(ya-y2) ) + sqrt( xb*xb + (yb-y2)*(yb-y2) );
if ( dist > dist1 ) {
dist = dist1;
y = y1;
}
if ( dist > dist2 ) {
dist = dist2;
y = y2;
}
}
ans = y;
}
printf( "%.9f", ans );
return 0;
}
tetsuzuki1115