最新研究:我算出了 Florr.io 里平均需要多少张 Common 才能合成一张 Super!

· · 个人记录

利用期望 dp 算法,我写出了以下代码:

#include<bits/stdc++.h>
using namespace std; 
const int N=1e7+5;
double f[N],ans=1;
string str[]={"Common","Unusuall","Rare","Epic","Legendary","Mythic","Ultra","Super"};
int now=0;
int main(){
    for(double k=0.64;k>=0.01;k/=2){
        memset(f,0,sizeof f);
        f[5]=k;
        double s=0;
        for(int i=5;i<N-1;++i)
            for(int j=i+1;j<=i+4&&j<N;++j)f[j]+=f[i]/4*(1-k);
        for(int i=0;i<N;++i)s+=f[i]*i;
        ans*=s;
        if(k!=0.01)ans*=5;
        cout<<str[now]<<"->"<<str[now+1]<<':'<<s<<endl;
        now++;
    }
    long long ss=ans;
    printf("Common->Super:%lld",ss);
    return 0;
}

输出:

Common->Unusuall:6.40625
Unusuall->Rare:10.3125
Rare->Epic:18.125
Epic->Legendary:33.75
Legendary->Mythic:65
Mythic->Ultra:127.5
Ultra->Super:252.5
Common->Super:1321370438430427

下面是按旧版本的合成概率计算的代码:

#include<bits/stdc++.h>
using namespace std; 
const int N=1e7+5;
double f[N],ans=1,tt[]={0.6,0.45,0.2,0.1,0.03,0.02,0.01};
string str[]={"Common","Unusuall","Rare","Epic","Legendary","Mythic","Ultra","Super"};
int now=0;
int main(){
    while(now<7){
        memset(f,0,sizeof f);
        double k=tt[now];
        f[5]=k;
        double s=0;
        for(int i=5;i<N-1;++i)
            for(int j=i+1;j<=i+4&&j<N;++j)f[j]+=f[i]/4*(1-k);
        for(int i=0;i<N;++i)s+=f[i]*i;
        ans*=s;
        if(k!=0.01)ans*=5;
        cout<<str[now]<<"->"<<str[now+1]<<':'<<s<<endl;
        now++;
    }
    long long ss=ans;
    printf("Common->Super:%lld",ss);
    return 0;
}

输出:

Common->Unusuall:6.66667
Unusuall->Rare:8.05556
Rare->Epic:15
Epic->Legendary:27.5
Legendary->Mythic:85.8333
Mythic->Ultra:127.5
Ultra->Super:252.5
Common->Super:956479712592210