結果
問題 | No.306 さいたま2008 |
ユーザー |
![]() |
提出日時 | 2015-11-27 22:57:59 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 909 bytes |
コンパイル時間 | 1,574 ms |
コンパイル使用メモリ | 158,608 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 00:17:05 |
合計ジャッジ時間 | 2,026 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘Point get()’: main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%lf%lf",&x,&y); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; //#define int long long typedef pair<int,int>pint; typedef vector<int>vint; #define pb push_back #define mp make_pair #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n) for(int i=(f);i<(n);i++) template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;} template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;} typedef complex<double>Point; Point get(){ double x,y; scanf("%lf%lf",&x,&y); return Point(x,y); } int main(){ Point A,B; A=get();B=get(); A*=1000;B*=1000; double lb=0,ub=1000000; for(int i=0;i<100;i++){ double m1=(lb*2+ub)/3,m2=(lb+ub*2)/3; Point p1(0,m1),p2(0,m2); double d1=abs(A-p1)+abs(B-p1); double d2=abs(A-p2)+abs(B-p2); if(d1+(1e-12)>d2)lb=m1; else ub=m2; } printf("%.20lf\n",lb/1000); return 0; }