QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#203559 | #6421. Degree of Spanning Tree | qzzyq | WA | 0ms | 3968kb | C++14 | 1.6kb | 2023-10-06 18:12:05 | 2023-10-06 18:12:05 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define maxn
#define put() putchar('\n')
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
using namespace std;
void read(int &x){
int f=1;x=0;char c=getchar();
while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
x*=f;
}
namespace Debug{
Tp void _debug(char* f,Ty t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,Ty x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
Tp ostream& operator<<(ostream& os,vector<Ty>& V){os<<"[";for(auto& vv:V) os<<vv<<",";os<<"]";return os;}
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
}using namespace Debug;
#define fi first
#define se second
#define mk make_pair
const int mod=1e9+7;
int power(int x,int y=mod-2) {
int sum=1;
while (y) {
if (y&1) sum=sum*x%mod;
x=x*x%mod;y>>=1;
}
return sum;
}
double n,m,p;
double pw(double x,int y) {
double sum=1;
while (y) {
if (y&1) sum=sum*x;
x=x*x;y>>=1;
}
return sum;
}
double calc(int x) {
return (n*x+m)/(1-pw(1-p,x));
}
void solve(void) {
scanf("%lf%lf%lf",&n,&m,&p);
p=p/10000;
int i,l=0,r=1e5,mid;double ans=1e15;
double sh=log2(n/m);
while (l+2<r) {
int lm=l+(r-l)/3;
int rm=l+(r-l)*2/3;
if (calc(lm)<calc(rm)) r=rm;
else l=lm;
}
for (i=max(1,l);i<=r;i++) ans=min(ans,calc(i));
printf("%.9lf\n",ans);
}
// 1000153595.96685
signed main(void){
int T;
read(T);
while (T--) solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3968kb
input:
2 6 9 1 2 1 3 1 4 2 3 2 4 3 4 4 5 4 6 4 6 3 4 1 3 2 3 3 3 1 2
output:
61042.214644837 6781.798934503
result:
wrong answer Line "61042.214644837" doesn't correspond to pattern "Yes|No"