QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227387#6801. BlackjackjzhCompile Error//C++141.7kb2023-10-27 13:49:162023-10-27 13:49:16

Judging History

你现在查看的是最新测评结果

  • [2023-10-27 13:49:16]
  • 评测
  • [2023-10-27 13:49:16]
  • 提交

answer


#include<bits/stdc++.h>
using namespace std ;
typedef long double db ;
const int maxn = 500 + 10 ;
db dp[2][maxn][maxn] ; //dp[i][j][k]表示前i个数选择j张且权值和是k的概率
db tmp[maxn][maxn] ;
int main()
{
    std::ios::sync_with_stdio(false) , cin.tie(0) ;
    int n , a , b ;
    cin >> n >> a >> b ;
    vector<int> x(n + 1 , 0) ;
    for(int i = 1 ; i <= n ; i ++)  cin >> x[i] ;
    dp[0][0][0] = 1.0 ;
    int op = 0 ;
    for(int i = 1 ; i <= n ; i ++)
    {
        op = 1 - op ;
        for(int j = 0 ; j <= i ; j ++)
            for(int k = 0 ; k <= 500 ; k ++)
            {
                dp[op][j][k] = dp[1 - op][j][k] ;
                if(j >= 1 && k >= x[i])  dp[op][j][k] += dp[1 - op][j - 1][k - x[i]] * j / (n + 1 - j) ;
            }
    }
    db ans = 0.0 ;
    for(int i = 1 ; i <= n ; i ++)
    {
        //撤销
        for(int j = 0 ; j < n ; j ++)
            for(int k = 0 ; k <= 500 ; k ++)
            {
                tmp[j][k] = dp[op][j][k] ;
                if(j >= 1 && k >= x[i])
                    tmp[j][k] -= tmp[j - 1][k - x[i]] * j / (n + 1 - j) ;
            }
 
        //计算
        for(int j = 0 ; j < n ; j ++)
            for(int k = 0 ; k <= 500 ; k ++)
            {
                if(a - x[i] < k && k <= min(b - x[i] , a))
                    ans += tmp[j][k] / (n - j) ;
            }
    }
    cout << fixed << setprecision(12) << ans << '\n' ;
    return 0 ;
}
————————————————
版权声明:本文为CSDN博主「敲代码的欧文」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Irving0323/article/details/115291600

Details

answer.code:50:1: error: extended character — is not valid in an identifier
   50 | ————————————————
      | ^
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:50:1: error: extended character — is not valid in an identifier
answer.code:51:1: error: extended character 「 is not valid in an identifier
   51 | 版权声明:本文为CSDN博主「敲代码的欧文」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
      | ^
answer.code:51:1: error: extended character 」 is not valid in an identifier
answer.code:51:67: error: extended character 。 is not valid in an identifier
   51 | 版权声明:本文为CSDN博主「敲代码的欧文」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
      |                                                                   ^
answer.code:50:1: error: ‘————————————————’ does not name a type
   50 | ————————————————
      | ^~~~~~~~~~~~~~~~