QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102478 | #5253. Denormalization | zswzswzsw# | WA | 0ms | 3696kb | C++14 | 962b | 2023-05-03 13:45:57 | 2023-05-03 13:46:00 |
Judging History
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;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
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