QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#526523 | #5253. Denormalization | solar_express# | WA | 84ms | 3756kb | C++20 | 889b | 2024-08-21 17:01:36 | 2024-08-21 17:01:38 |
Judging History
answer
#include<bits/stdc++.h>
#define N 10005
#define db double
using namespace std;
const db eps=1e-8;
db a[N];
int ans[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;++i)
cin>>a[i];
int pos=0;
for(int i=2;i<=n;++i)
if(a[i]<a[1]-eps||a[1]+eps<a[i]){
pos=i;
break;
}
if(pos==0){
for(int i=1;i<=n;++i)
cout<<"1\n";
return 0;
}
bool fl=1;
for(int i=1;i<=10000&&fl;++i)
for(int j=1;j<=10000&&fl;++j){
db va=a[1]*j,vb=a[pos]*i;
if(fabs(va-vb)<eps){
ans[1]=i;
fl=0;
}
}
for(int i=2;i<=n;++i){
ans[i]=int(1ll*ans[1]*a[i]/a[1]+eps);
}
for(int i=1;i<=n;++i)
cout<<ans[i]<<'\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 84ms
memory: 3756kb
input:
2 0.909840249060 0.414958698174
output:
9665 4408
result:
ok good solution
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3744kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
15 1821 1878
result:
wrong answer the greatest common divisor is 3, but expected 1.