QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#554012 | #2754. Playing the Slots | Tenshi# | WA | 0ms | 3908kb | C++20 | 2.4kb | 2024-09-09 01:44:45 | 2024-09-09 01:44:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << (x) << endl
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define dwn(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define x first
#define y second
using pii = pair<int, int>;
using ll = long long;
inline void read(int &x){
int s=0; x=1;
char ch=getchar();
while(ch<'0' || ch>'9') {if(ch=='-')x=-1;ch=getchar();}
while(ch>='0' && ch<='9') s=(s<<3)+(s<<1)+ch-'0',ch=getchar();
x*=s;
}
const double eps=1e-8, pi=acos(-1);
/*start-----------------------------------------------------------------*/
struct Point{
double x, y;
Point(double x=0, double y=0): x(x), y(y){}
};
typedef Point Vector;
Vector operator + (Vector A, Vector B){return Vector(A.x+B.x, A.y+B.y);}
Vector operator - (Vector A, Vector B){return Vector(A.x-B.x, A.y-B.y);}
Vector operator * (Vector A, Vector B){return Vector(A.x*B.x, A.y*B.y);}
Vector operator / (Vector A, Vector B){return Vector(A.x/B.x, A.y/B.y);}
int sign(double x){
if(fabs(x)<eps) return 0;
return x<0? -1: 1;
}
int cmp(double x, double y){
return sign(x-y);
}
bool operator < (const Point &a, const Point &b) {
return sign(a.x-b.x)<0 || sign(sign(a.x-b.x)==0 && sign(a.y-b.y)<0);
}
double dot(Vector A, Vector B){
return A.x*B.x+A.y*B.y;
}
double cross(Vector A, Vector B){
return A.x*B.y-A.y*B.x;
}
double get_length(Vector A){
return sqrt(dot(A, A));
}
double get_dist(Point a, Point b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
double get_angle(Vector A, Vector B){
return acos(dot(A, B)/get_length(A)/get_length(B));
}
double area(Point a, Point b, Point c){
return cross(b-a, c-a);
}
double displ(Point a, Point b, Point c){
double s=abs(area(a, b, c));
double d=get_dist(b, c);
return s/d;
}
// 向量 A 顺时针旋转 angle 度
Vector rotate(Vector A, double angle){
return Vector(A.x*cos(angle)+A.y*sin(angle), -A.x*sin(angle)+A.y*cos(angle));
}
Point pt[110];
int n;
signed main(){
cin>>n;
rep(i, 1, n) cin>>pt[i].x>>pt[i].y;
double res=1e9;
rep(i, 1, n){
double t=0;
rep(j, 1, n){
int k=j%n+1;
t=max(t, displ(pt[i], pt[j], pt[k]));
}
res=min(res, t);
}
printf("%.2lf\n", res);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3760kb
input:
3 0 0 0.71 3.54 4.21 4.21
output:
2.00
result:
ok found '2.00000', expected '2.00000', error '0.00000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
6 10 12.5 10 17.5 15 20 20 17.5 20 12.5 15 10
output:
8.94
result:
ok found '8.94000', expected '8.94000', error '0.00000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
4 0 0 0 100 100 100 100 0
output:
100.00
result:
ok found '100.00000', expected '100.00000', error '0.00000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3836kb
input:
4 1 0 0 1 99 100 100 99
output:
140.01
result:
wrong answer 1st numbers differ - expected: '1.41000', found: '140.01000', error = '98.29787'