QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103102 | #5253. Denormalization | aguo123 | WA | 2ms | 3412kb | C++11 | 1.1kb | 2023-05-04 14:39:10 | 2023-05-04 14:39:11 |
Judging History
answer
#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e5+10;
typedef long long LL;
const LL mod=998244353;
const double eps=1e-7;
int n,T;
LL a[N],f[N];
LL mx=1e6;
double x[N];
LL qmi(LL a,LL b){
LL res=1;
while(b){
if(b&1)res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
LL Gcd(LL a,LL b){
return b?Gcd(b,a%b):a;
}
int main()
{
cin>>n;
int vis=0;
for(int i=1;i<=n;i++)cin>>x[i];
for(int i=1;i<=mx;i++){
int flag=1;
for(int j=1;j<=n;j++){
int y=(int)(x[j]*(double)i+0.5);
double t=(double)y/(double)i;
if(abs(t-x[j])>eps)flag=0;
}
if(flag)vis=1;
if(vis){
// cout<<i<<endl;
for(int j=1;j<=n;j++)a[j]=(LL)(x[j]*(double)i);
int d=Gcd(a[1],a[2]);
for(int j=3;j<=n;j++)d=(a[j],d);
for(int j=1;j<=n;j++)cout<<a[j]/d<<endl;
break;
}
// cout<<(int)(4.9)<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3412kb
input:
2 0.909840249060 0.414958698174
output:
13539 6175
result:
wrong answer Integer parameter [name=r_i] equals to 13539, violates the range [1, 10000]