QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#437523 | #8785. Fake Coin and Lying Scales | ucup-team1004 | WA | 5ms | 4096kb | C++14 | 694b | 2024-06-09 12:29:56 | 2024-06-09 12:29:57 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned ll;
int T,n,k;
double frac(int n){
if(!n)return 0;
return n*(log(n)-1)+1;
}
double C(int n,int k){
return frac(n)-frac(k)-frac(n-k);
}
double calc(int n,int k){
k=min(k,n);
return log(2)*k+C(n,k);
}
void get(){
scanf("%d%d",&n,&k);
printf("%.10lf\n",log(3ll*k+1)+log(3)*n-calc(n,k));
}
int main(){
for(scanf("%d",&T);T--;)get();
return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4096kb
input:
2 100 0 100 1
output:
109.8612288668 105.9542226119
result:
ok q=0 (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 4048kb
input:
10000 32 6 45 98 67 57 35 70 29 3 22 81 59 12 48 16 63 69 99 36 60 36 32 47 73 91 81 30 7 7 71 57 38 60 35 19 92 40 3 17 21 71 54 62 95 67 60 50 10 20 19 80 64 73 10 21 70 97 84 3 26 22 38 47 37 38 31 91 11 37 73 17 75 98 8 74 73 60 87 10 94 48 35 73 18 14 88 25 61 54 39 59 100 90 70 98 73 21 92 11 ...
output:
19.4986670475 23.9329052212 12.0104962230 19.5431369173 23.4376677076 14.4174006037 31.3123846647 15.9821751871 30.8818398905 24.6079703440 6.2740866816 17.9307105171 35.2120809983 20.3126866622 5.9292982101 9.3900312916 20.6061711394 6.2106546912 16.1575363229 5.1676390429 13.8807432853 27.12622445...
result:
wrong answer WA (test case 9)