QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#73377 | #4392. Bowcraft | poi | AC ✓ | 38ms | 5568kb | C++ | 1.5kb | 2023-01-24 19:10:42 | 2023-01-24 19:10:42 |
Judging History
answer
#include "iostream"
#include "cstring"
#include "cstdio"
#include "algorithm"
#include "queue"
#include "vector"
#include "queue"
#include "stack"
#include "ctime"
#include "set"
#include "map"
#include "cmath"
using namespace std;
#define fi first
#define se second
#define vi vector<int>
#define pb push_back
#define eb emplace_back
#define pii pair<int,int>
#define mp make_pair
#define rep( i , a , b ) for( int i = (a) , i##end = b ; i <= i##end ; ++ i )
#define per( i , a , b ) for( int i = (a) , i##end = b ; i >= i##end ; -- i )
#define mem( a ) memset( a , 0 , sizeof (a) )
#define all( x ) x.begin() , x.end()
//#define int long long
typedef long long ll;
const int MAXN = 2e5 + 10;
int n , m;
int A , B;
double f[MAXN] , S[MAXN];
void solve() {
cin >> n >> A >> B;
vi pt;
rep( i , 1 , B ) pt.pb( i );
// S[1] = 2.5;
rep( k , 1 , n ) {
double l = 0 , r = 1e5;
while( r - l > 1e-9 ) {
double mid = ( l + r ) / 2;
double a = 0 , b = 0;
rep( i , 0 , A - 1 ) {
double t;
if( k > 1 ) t = min( ceil( mid * i * B * 1. / ( ( A - i ) * S[k - 1] ) ) , B * 1. );
else t = B;
a += t * i , b += ( A - i ) * t * ( t - 1. ) * S[k - 1] / ( B * 2 );
// cout << t << ' ';
}
// puts("");
b += B * A * A;
if( b / a < mid ) r = mid;
else l = mid;
}
f[k] = r;
S[k] = S[k - 1] + f[k];
// cout << f[k] << endl;
}
printf("%.3lf\n",S[n]);
}
signed main() {
// freopen("in","r",stdin);
// freopen("out","w",stdout);
int T;cin >> T;while( T-- ) solve();
// solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 38ms
memory: 5568kb
input:
10 996 99 66 904 99 86 609 85 57 729 63 57 617 78 72 751 81 89 952 93 94 791 58 66 726 94 75 1000 100 100
output:
77416.113 75591.341 35314.209 48508.448 40062.330 58921.716 85820.717 59676.753 51117.885 93950.049
result:
ok 10 lines