QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90503 | #5253. Denormalization | SolitaryDream# | WA | 10ms | 3728kb | C++17 | 897b | 2023-03-23 13:31:24 | 2023-03-23 13:31:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define double long double
const int N=1e4+1e2+7;
const double eps=1e-8;
int n,a[N];
double x[N];
int main()
{
scanf("%d",&n);
vector<int>s(n+1);
for(int i=1;i<=n;i++)
scanf("%Lf",&x[i]);
int p=max_element(x+1,x+n+1)-x;
for(int w=1;w<=10000;w++)
{
a[p]=w;
bool ok=1;
double s=w*w;
for(int i=1;i<=n;i++)
if(i!=p)
{
double r=w*x[i]/x[p];
int x=floorl(r+0.5);
if(fabs(1.0*x-r)>eps)
ok=0;
a[i]=x;
s+=x*x;
}
if(!ok)
continue;
if(fabs(w/sqrt(s)-x[p])<1e-6)
{
for(int i=1;i<=n;i++)
printf("%d\n",a[i]);
return 0;
}
}
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3728kb
input:
2 0.909840249060 0.414958698174
output:
9665 4408
result:
ok good solution
Test #2:
score: 0
Accepted
time: 3ms
memory: 3644kb
input:
3 0.005731604132 0.696198848562 0.717826101486
output:
75 9110 9393
result:
ok good solution
Test #3:
score: -100
Wrong Answer
time: 10ms
memory: 3492kb
input:
10 0.338936215010 0.390914583549 0.048893426174 0.446152513833 0.137891103101 0.017985796057 0.459132554353 0.201452557127 0.362800863500 0.358493585479
output:
result:
wrong output format Unexpected end of file - int32 expected