QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#103119#5253. Denormalizationaguo123WA 2ms3416kbC++111.1kb2023-05-04 15:12:062023-05-04 15:12:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-04 15:12:10]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3416kb
  • [2023-05-04 15:12:06]
  • 提交

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