QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#369328#2430. Gem IslandInfinityNSCompile Error//C++141.0kb2024-03-28 00:34:272024-03-28 00:34:28

Judging History

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

  • [2024-03-28 00:34:28]
  • 评测
  • [2024-03-28 00:34:27]
  • 提交

answer

#include<bits/stdc++.h>

#define f first
#define s second
#define ld long double
#define pb push_back
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

const int N=1001;
int n,d,r;
ld nck[N][N],dp[N][N];
int main(){
    scanf("%i %i %i",&n,&d,&r);
    for(int k=0;k<=n+d;k++){
        for(int sum=0;sum<=n+d;sum++){
            if(sum<k)nck[sum][k]=0;
            else{
                if(sum==0||k==0)nck[sum][k]=1;
                else{
                    nck[sum][k]=nck[sum-1][k-1]+nck[sum-1][k];
                }
            }3 3
        }
    }
    for(int sum=0;sum<=n+d;sum++)
        dp[sum][0]=0;
    for(int k=1;k<=n;k++){
        for(int sum=0;sum<=n+d;sum++){
            dp[sum][k]=0;
            if(sum>=k){
                dp[sum][k]+=min(k,r)*nck[sum-1][k-1];
                for(int jed=0;jed<=k;jed++){
                    dp[sum][k]+=nck[k][jed]*dp[sum-k][k-jed];
                }
            }
        }
    }
    printf("%.10Lf\n",(ld)dp[n+d][n]/nck[d+n-1][n-1]);
}


详细

answer.code: In function ‘int main()’:
answer.code:24:15: error: expected ‘;’ before numeric constant
   24 |             }3 3
      |               ^~
      |               ;
answer.code:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     scanf("%i %i %i",&n,&d,&r);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~