QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#384419#4005. FrogwdwWA 0ms4172kbC++202.7kb2024-04-09 23:20:282024-04-09 23:20:29

Judging History

你现在查看的是最新测评结果

  • [2024-04-09 23:20:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4172kb
  • [2024-04-09 23:20:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
//#define int long long
const int N=2e5+5;
#define endl '\n'
const double pi=acos(-1);
const double eps=1e-10;
double l(double x1,double y1,double x2,double y2){
    return sqrt(1.0*(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
void solve(){
    double a,b;
    cin>>a>>b;
    double x1=cos(1.0*pi*a/180),y1=sin(1.0*pi*a/180),x2=cos(1.0*pi*b/180),y2=sin(1.0*pi*b/180);
    double len=sqrt(1.0*(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2;
    double h=sqrt(1.0-len*len);
    double z1=(x1+x2)/2,z2=(y1+y2)/2;
    double yy1=z1*2,yy2=z2*2;
    vector<pair<double,double>>px;
    px.push_back({x1,y1});
    if(a==b){
        cout<<0<<endl;
        cout<<x1<<" "<<y1<<endl;
        return;
    }
    //cout<<z1<<" "<<z2<<endl;
    if(z1<eps&&z2<eps) {
        if (abs(x1 - x2) < eps) {
            if (y1 < y2) {
                px.push_back({x1 - 1, y1});
                px.push_back({x1 - 1, y1 + 1});
                px.push_back({x1 - 1, y1 + 2});
                px.push_back({x2, y2});
            } else {
                px.push_back({x1 - 1, y1});
                px.push_back({x1 - 1, y1 - 1});
                px.push_back({x1 - 1, y1 - 2});
                px.push_back({x2, y2});
            }
        } else if (abs(y1 - y2) < eps) {
            if (x1 < x2) {
                px.push_back({x1, y1 + 1});
                px.push_back({x1 + 1, y1 + 1});
                px.push_back({x1 + 2, y1 + 1});
                px.push_back({x2, y2});
            } else {
                px.push_back({x1, y1 + 1});
                px.push_back({x1 - 1, y1 + 1});
                px.push_back({x1 - 2, y1 + 1});
                px.push_back({x2, y2});
            }
        } else {
            double xxx = cos((1.0 * pi * a + 1.0 * pi * b) / 2 / 180), yyy = sin(
                    (1.0 * pi * a + 1.0 * pi * b) / 2 / 180);
            px.push_back({x1 + xxx, y1 + yyy});
            px.push_back({xxx, yyy});
            px.push_back({x2 + xxx, y2 + yyy});
            px.push_back({x2, y2});
        }
    }else{
        cout<<abs(l(0,0,yy1,yy2))<<endl;
        if(abs(a-b)>90){
            px.push_back({x1+z1,y1+z2});
            px.push_back({yy1+z1,yy2+z2});
            px.push_back({x2+z1,y2+z2});
            px.push_back({x2,y2});
        }else{
            px.push_back({yy1,yy2});
            px.push_back({x2,y2});
        }
    }
    cout<<px.size()-1<<endl;
    for(auto y:px){
        cout<<y.first<<" "<<y.second<<endl;
    }
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    cout<<fixed<<setprecision(12);
    int T=1;
    cin>>T;
    while(T--) solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4172kb

input:

3
0 0
0 90
180 0

output:

0
1.000000000000 0.000000000000
1.414213562373
2
1.000000000000 0.000000000000
1.000000000000 1.000000000000
0.000000000000 1.000000000000
4
-1.000000000000 0.000000000000
-1.000000000000 1.000000000000
0.000000000000 1.000000000000
1.000000000000 1.000000000000
1.000000000000 0.000000000000

result:

wrong output format Expected integer, but "1.414213562373" found