QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102478#5253. Denormalizationzswzswzsw#WA 0ms3696kbC++14962b2023-05-03 13:45:572023-05-03 13:46:00

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 13:46:00]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3696kb
  • [2023-05-03 13:45:57]
  • 提交

answer

#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
const int N=1e4+10;
double eps=1e-3,ep=1e-5;
long double x[N];
int a[N];
int n;

int _gcd(int x,int y){
    return y?_gcd(y,x%y):x;
}

bool test(long double d){
    long double rel=0;
    int gcd=0;
    for(int i=1;i<=n;++i)
        a[i]=x[i]*d+0.1,
        gcd=(gcd==0?a[i]:_gcd(gcd,a[i]));
    for(int i=1;i<=n;++i)
        a[i]/=gcd,
        rel+=a[i]*a[i];
    rel=sqrt(rel);
    for(int i=1;i<=n;++i)
        if(abs(a[i]/rel-x[i])>ep)
            return false;
    for(int i=1;i<=n;++i)
        cout<<a[i]<<endl;
    return true;
}

long double res(long double x){
    return abs(x-(long long)(x+0.1));
}

int main(){
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>x[i];
    for(int i=1;i<=10000;++i){
        if(i<=10)
        if(res(i*i/x[1]/x[1])<eps)
            if(test(i/x[1])){
                return 0;
            }
    }
}

详细

Test #1:

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

input:

2
0.909840249060
0.414958698174

output:


result:

wrong output format Unexpected end of file - int32 expected