QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#293700 | #4003. Rounding Master | YunQian | Compile Error | / | / | C++14 | 1.7kb | 2023-12-29 16:42:49 | 2023-12-29 16:42:49 |
Judging History
This is the latest submission verdict.
- [2023-12-29 16:42:49]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2023-12-29 16:42:49]
- Submitted
answer
#include<bits/stdc++.h>
#define ll long long
#define mk make_pair
#define fi first
#define int __int128
#define se second
#define double long double
using namespace std;
inline int read(){
int x=0,f=1;char c=getchar();
for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
return x*f;
}
const int mod=998244353;
int ksm(int x,int y,int p=mod){
int ans=1;
for(int i=y;i;i>>=1,x=1ll*x*x%p)if(i&1)ans=1ll*ans*x%p;
return ans%p;
}
int inv(int x,int p=mod){return ksm(x,p-2,p)%p;}
mt19937 rnd(time(0));
int randint(int l,int r){return rnd()%(r-l+1)+l;}
void add(int &x,int v){x+=v;if(x>=mod)x-=mod;}
void Mod(int &x){if(x>=mod)x-=mod;}
int cmod(int x){if(x>=mod)x-=mod;return x;}
void cmax(int &x,int v){x=max(x,v);}
void cmin(int &x,int v){x=min(x,v);}
int n,k;
#define EPS 1e-7
int dcmp(double x){
if(fabs(x)<EPS)return 0;
if(x>0)return 1;
return -1;
}
signed main(void){
#ifndef ONLINE_JUDGE
freopen("in.in","r",stdin);
#endif
int x=1;
n=read(),k=read();
double L=1.5;
auto to=[&](int t,double v){
double tt=t;
tt=tt*v;
return ((int)(tt+0.5));
};
if(k==1){
cout<<fixed<<setprecision(6)<<R-0.5<<endl;
return 0;
}
if(k>=200)return puts("1.5"),0;
double R=n;
while(dcmp(R-L)>0){
double mid=(L+R)/2.000;
// cout<<"L,R = "<<L<<" "<<R<<endl;
// cout<<"mid = "<<fixed<<setprecision(6)<<mid<<endl;
int cur=x;bool chk=0;
for(int i=1;i<=k;i++){
cur=to(cur,mid);
if(cur>=n){chk=1;break;}
}
// cout<<"chk = "<<chk<<" -> L,R = "<<L<<" "<<R<<endl;
if(chk)R=mid;
else L=mid;
}
cout<<fixed<<setprecision(6)<<L<<endl;
// int cnt=0;
// while(x<n)cnt++,x=to(x,L);
// cout<<"cnt = "<<cnt<<endl;
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:58:47: error: ‘R’ was not declared in this scope 58 | cout<<fixed<<setprecision(6)<<R-0.5<<endl; | ^