QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129245#5253. DenormalizationSommohito#WA 1ms3772kbC++201.3kb2023-07-22 11:50:212023-07-22 11:50:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 11:50:24]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3772kb
  • [2023-07-22 11:50:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
#define ALL(x) x.begin(),x.end()

const int N=1e4+5;
ld r[N];
int a[N];
int n;

bool ok()
{
    int g=0;
    for(int i=0;i<n;i++) g=__gcd(g,a[i]);
    if(g!=1)
        return 0;
    ld s= 0;
    for(int i=0;i<n;i++)
        s+=a[i]*a[i];
    s=sqrt(s);
    for(int i=0;i<n;i++)
    {
        if(abs(a[i]/s-r[i])>=1e-6)
            return 0;
    }
    return 1;
}

void TEST_CASES()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>r[i];
        r[i]=floorl((r[i]*1e6))/1e6;
        debug(i,r[i]);
    }
    for(int x=1;x<=10000;x++)
    {
        for(int i=0;i<n;i++)
        {
            a[i]= round(r[i]*x/r[0]);
        }
        if(ok())
        {
            for(int i=0;i<n;i++)
                cout<<a[i]<<"\n";
            return ;
        }
    }
    assert(0);
}


/*
*/

int32_t main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("out1.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
        TEST_CASES();
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3772kb

input:

2
0.909840249060
0.414958698174

output:

831
379

result:

wrong answer incorrect solution