QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#283047#6648. 总投票数one_god_and_two_dogs#WA 5ms3908kbC++141.2kb2023-12-13 18:40:192023-12-13 18:40:20

Judging History

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

  • [2023-12-13 18:40:20]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3908kb
  • [2023-12-13 18:40:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int Mx=1e6;
const double eps=1e-8;
int n,m;
double p[105];
double l[105],r[105];
char S[10];
int len;
double mi=1.0;
int main() {
    scanf("%d",&n);
    for(int i=1; i<=n; ++i) {
        scanf("%s",&S);
        len=strlen(S);
        if(S[0]=='1')p[i]=1;
        for(int j=2; j<len; ++j)
            p[i]=p[i]*10+(S[j]^48);
    }
    for(int i=1; i<=len-2; ++i)mi=mi*0.1;
    for(int i=1; i<=n; ++i) {
        p[i]*=mi;
        l[i]=p[i]-mi/2,r[i]=p[i]+mi/2;
    }
    while(true) {
        ++m;
        bool f=true;
        for(int j=1; j<=n; ++j) {
            double x=l[j]*m,y=r[j]*m;
            int xx=int(x),yy=int(y);
            if((y-yy)<=eps&&(x-xx)>eps&&yy==xx+1)f=false;
            if(xx==yy&&(x-xx)>eps)f=false;
            //if(m==7766)cout<<xx<<" "<<yy<<" "<<x<<" "<<y<<endl;
            if(!f)break;
        }
        if(f)break;
    }printf("%d",m);
    return 0;
}
/*
13
0.00155
0.03876
0.01584
0.05189
0.08099
0.06825
0.15658
0.10404
0.02640
0.14332
0.12941
0.15529
0.02768

7
0.041096
0.109589
0.109589
0.164384
0.301370
0.068493
0.205479
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 5ms
memory: 3908kb

input:

100
0.009862
0.010100
0.009996
0.010052
0.009983
0.009759
0.009846
0.010008
0.010085
0.009909
0.010107
0.010161
0.010011
0.009956
0.009948
0.009979
0.010020
0.009991
0.010060
0.010080
0.009949
0.009897
0.010135
0.010042
0.010003
0.009957
0.009934
0.009838
0.010195
0.010249
0.009908
0.009959
0.010060...

output:

925478

result:

wrong answer 1st numbers differ - expected: '942983', found: '925478'