QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#473691 | #6829. It Takes Two of Two | prime-ideal | WA | 0ms | 3948kb | C++20 | 1.2kb | 2024-07-12 13:15:15 | 2024-07-12 13:15:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define RN return
#define forw(_,l,r) for(auto _=(l);_<(r);++_)
#define fors(_,r,l) for(auto _=(r);_>(l);--_)
// #define DEBUG if((cout<<"line:"<<__LINE__<<'\n'), 1)
#define DEBUG if(0)
// #define int ll
#define fastio cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
void read(){}
template<typename T,typename...Types>
void read(T& x, Types&...args){
x=0; char c=' '; bool sgn=0;
while(isspace(c))c=getchar();
if(c=='-')c=getchar(),sgn=1;
while(isdigit(c))x=10*x+c-'0',c=getchar();
if(sgn)x=-x;
read(args...);
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int NUM=210;
ld dp[NUM][NUM][NUM]={};
int n;
void calc(){
forw(i,0,n+1)forw(j,0,n/2+1)forw(k,0,n/3+1){
vector<tuple<int,int,int,int>> v={
{i*(i-1)/2,i-2,j+1,k},{i*2*j,i-1,j-1,k+1},
{i*2*k,i-1,j,k},{j*(2*j-2),i,j-1,k},
{2*j*2*k,i,j-1,k},{k*(2*k-2),i,j,k-1},
{k,i,j,k-1}};
int sum=0;ld ret=n*n*0.5;//!
for(auto [w,i1,j1,k1]:v){
sum+=w,ret+=dp[i1+2][j1+2][k1+2]*w;
}dp[i+2][j+2][k+2]=sum?ret/sum:0;//!
}
}
int main()
{
read(n);calc();
printf("%.9Lf\n",dp[n+2][2][2]);
RN 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3948kb
input:
1
output:
0.000000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
2
output:
2.000000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
3
output:
8.250000000
result:
ok found '8.2500000', expected '8.2500000', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3808kb
input:
4
output:
9.733333333
result:
wrong answer 1st numbers differ - expected: '11.3333333', found: '9.7333333', error = '0.1411765'