QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283067 | #6648. 总投票数 | one_god_and_two_dogs# | WA | 18ms | 3928kb | C++14 | 971b | 2023-12-13 19:07:43 | 2023-12-13 19:07:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int Mx=1e6;
int n,m;
LL p[105];
LL 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);
}
int Base=1;
for(int i=1; i<len; ++i)Base=Base*10;
for(int i=1; i<=n; ++i) {
p[i]*=10;
l[i]=p[i]-5,r[i]=p[i]+5;
}
while(m<=Mx) {
++m;
bool f=true;
LL L=0,R=0;
for(int i=1; i<=n; ++i) {
LL xx=l[i]*m,yy=r[i]*m;
LL x=xx/Base,y=yy/Base;
if(xx%Base!=0)x++;
if(yy%Base==0)y--;
if(x>y)f=false;
L+=x;R+=y;
if(!f)break;
}
if(L>m||R<m)f=false;
if(f)break;
}printf("%d",m);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 18ms
memory: 3920kb
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:
942983
result:
ok 1 number(s): "942983"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3928kb
input:
100 0.0 0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.0 0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ...
output:
20
result:
wrong answer 1st numbers differ - expected: '10', found: '20'