QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103119 | #5253. Denormalization | aguo123 | WA | 2ms | 3416kb | C++11 | 1.1kb | 2023-05-04 15:12:06 | 2023-05-04 15:12:10 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include "cmath"
using namespace std;
const int N=1e5+10;
typedef long long LL;
const LL mod=998244353;
const double eps=1e-3;
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];
int ans;
for(int i=1;i<=mx;i++){
if(vis)break;
int flag=1;
for(int j=1;j<=n;j++){
int y=(int)(x[j]*(double)i+0.5);
if(y>10000){vis=1,ans=i-1;}
double t=(double)y/(double)i;
if(abs(t-x[j])>eps)flag=0;
}
if(flag)vis=1,ans=i;
// cout<<(int)(4.9)<<endl;
}
for(int j=1;j<=n;j++)a[j]=(LL)(x[j]*(double)ans+0.5);
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;
// cout<<(int)sqrt(1127*1127+514*514)<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3416kb
input:
2 0.909840249060 0.414958698174
output:
35 16
result:
wrong answer incorrect solution