QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#283062 | #6648. 总投票数 | one_god_and_two_dogs# | TL | 0ms | 0kb | C++14 | 1.2kb | 2023-12-13 18:53:24 | 2023-12-13 18:53:24 |
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(true) {
++m;
bool f=true;
int L=0,R=0;
for(int i=1; i<=n; ++i) {
int x=l[i]*m/Base,y=r[i]*m/Base;
if((l[i]*m)%Base==0){L+=x;R+=x;continue;}
if(((r[i]*m)%Base==0&&x+1==y)||x==y)f=false;
L+=x+1;
if((r[i]*m)%Base!=0)R+=y;
else R+=y-1;
if(!f)break;
}
if(L>n||R<n)f=false;
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
*/
詳細信息
Test #1:
score: 0
Time Limit Exceeded
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...