QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90163 | #5253. Denormalization | chiranko# | WA | 2ms | 3640kb | C++14 | 809b | 2023-03-22 14:02:57 | 2023-03-22 14:03:01 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(l,r) for(int i=l;i<=r;i++)
#define jrep(l,r) for(int j=l;j<=r;j++)
using namespace std;
typedef long double LD;
typedef long long ll;
const int N=1e4+10;
int n;
LD a[N];
int b[N],c[N];
LD p[N];
bool check(int x)
{
rep(1,n)c[i]=round((double)b[i]/x);
int d=c[1];
rep(1,n)d=__gcd(d,c[i]);
rep(1,n)c[i]/=d;
rep(1,n)if(c[i]>10000)return false;
LD q=0;
rep(1,n)q+=(LD)b[i]*b[i];
q=sqrt(q);
rep(1,n)p[i]=b[i]/q;
rep(1,n)if(fabsl(p[i]-a[i])>1e-6)return false;
return true;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n;
rep(1,n)cin>>a[i];
rep(1,n)b[i]=round(sqrtl(a[i]*a[i]*1e16));
rep(1,10000)if(check(i))
{
jrep(1,n)cout<<c[j]<<"\n";
//jrep(1,n)cout<<p[j]<<"\n";
return 0;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3496kb
input:
2 0.909840249060 0.414958698174
output:
9073 4138
result:
ok good solution
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3640kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
71 8627 8895
result:
wrong answer incorrect solution