QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#129244 | #5253. Denormalization | Sommohito# | WA | 0ms | 3620kb | C++20 | 1.3kb | 2023-07-22 11:45:29 | 2023-07-22 11:45:30 |
Judging History
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()
{
ld s= 0;
int g=0;
for(int i=0;i<n;i++) g=__gcd(g,a[i]);
if(g!=1)
return 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]=int((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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
2 0.909840249060 0.414958698174
output:
831 379
result:
wrong answer incorrect solution