QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#526523#5253. Denormalizationsolar_express#WA 84ms3756kbC++20889b2024-08-21 17:01:362024-08-21 17:01:38

Judging History

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

  • [2024-08-21 17:01:38]
  • 评测
  • 测评结果:WA
  • 用时:84ms
  • 内存:3756kb
  • [2024-08-21 17:01:36]
  • 提交

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.