QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#418843 | #6648. 总投票数 | LinkWish# | WA | 317ms | 3584kb | C++14 | 1.7kb | 2024-05-23 16:04:34 | 2024-05-23 16:04:35 |
Judging History
answer
//Linkwish's code
#include<bits/stdc++.h>
#define endl '\n'
#define si static inline
#define mp make_pair
#define fi first
#define se second
using namespace std;typedef long long ll;typedef __int128 li;typedef long double ld;
typedef pair<int,int> pii;typedef pair<ll,ll> pll;typedef const int ci;
typedef const ll cl;const int iinf=INT_MAX;const ll linf=LLONG_MAX;
template<typename T>si bool gmax(T &x,const T y){if(x<y)return x=y,1;return 0;}
template<typename T>si bool gmin(T &x,const T y){if(y<x)return x=y,1;return 0;}
namespace LinkWish{
ci N=105;
const ld eps=5e-7;
int n,m;
string a[N];
int cur[N];
si string ts(ld x){
string res="0.";
// cerr<<"TS "<<x<<endl;
while(res.size()<=m){
int k=x*10;
res+=char('0'+k),x=x*10-k;
// cerr<<k<<' '<<x<<endl;
}
// cerr<<res<<endl;
if(res.back()>='5'){
for(int i=m-1;i>1;i--){
if(res[i]=='9')res[i]='0';
else{
res[i]++;
break;
}
}
}
res.pop_back();
return res;
}
void mian(){
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
m=a[1].size();
cerr<<fixed<<setprecision(6);
for(int i=1;i<=1000000;i++){
bool flag=1;
ld d=(ld)1/i;
for(int j=1;j<=n;j++){
if(cur[j])cur[j]--;
string now=ts(cur[j]*d);
// if(i==7766)cerr<<j<<' '<<cur[j]<<' '<<now<<' '<<cur[j]*d<<endl;
while(now<a[j])now=ts((++cur[j])*d);
// if(i==7766)cerr<<j<<' '<<cur[j]<<' '<<d<<' '<<now<<' '<<cur[j]*d<<' '<<a[j]<<endl;
if(now!=a[j]){flag=0;break;}
}
if(flag){
cout<<i<<endl;
return ;
}
}
}
}
signed main(){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
#endif
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
LinkWish::mian();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 317ms
memory: 3584kb
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'