結果
| 問題 | No.306 さいたま2008 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-27 23:21:50 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 770 bytes |
| 記録 | |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 72,664 KB |
| 実行使用メモリ | 16,192 KB |
| 最終ジャッジ日時 | 2026-04-04 09:08:32 |
| 合計ジャッジ時間 | 8,527 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 8 TLE * 1 -- * 15 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:45:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:232:25: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
232 | { return _M_insert(__f); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:38:24: note: 'ans' was declared here
38 | double ans;
| ^~~
ソースコード
#include <iostream>
#include <string>
using namespace std;
double min(double a, double b)
{
if (a > b) return b;
else return a;
}
double max(double a, double b)
{
if (a < b) return b;
else return a;
}
int main()
{
double ax, ay, bx, by;
double p;
cin >> ax >> ay;
cin >> bx >> by;
if (ax == bx && ay == by) {
cout << ay << endl;
return 0;
}
else if (ax == bx) {
cout << (ay + by) / 2 << endl;
return 0;
}
else if (ay == by) {
cout << ay << endl;
return 0;
}
else {
double tmp = 10000000;
double ans;
for (p = min(ay, by); p < max(ay, by); p += 0.0000005) {
if (tmp >(ay - p)*(ay - p) + (by - p)*(by - p)) {
tmp = (ay - p)*(ay - p) + (by - p)*(by - p);
ans = p;
}
}
cout << ans << endl;
return 0;
}
return 0;
}