QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#456165#8774. Manhattan Walkucup-team3699#Compile Error//C++23937b2024-06-27 11:57:002024-06-27 11:57:01

Judging History

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

  • [2024-06-27 11:57:01]
  • 评测
  • [2024-06-27 11:57:00]
  • 提交

answer

//#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first 
#define S second
#define pb push_back

const int mol=1e9+7;

double dp[1005][1005], tw[1000005];
void solve(){
    int r, c, p;
    cin>>r>>c>>p;
    dp[1][1]=1;
    tw[0]=1;
    for(int i=1;i<=r*c;i++) tw[i]=tw[i-1]*2;
    double ans=0;
    for(int i=1;i<=r;i++){
        for(int j=1;j<=c;j++){
            if(i==1&&j==1) continue;
            dp[i][j]=dp[i-1][j]+dp[i][j-1];
            if(i==r&&j==c) break;
            if(j==c||i==r) {
                ans+=dp[i][j]*tw[r*c-(i+j-2)];
                // cerr<<dp[i][j]<<" "<<ans<<"\n";
                dp[i][j]*=2;
            }
        }
    }
    ans*=p/2;
    ans/=tw[r*c];
    cout<<fixed<<setprecision(10)<<ans<<"\n";
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    // int t;
    // cin>>t;
    // while(t--)
    solve();
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:14:5: error: ‘cin’ was not declared in this scope
   14 |     cin>>r>>c>>p;
      |     ^~~
answer.code:1:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
  +++ |+#include <iostream>
    1 | //#include<bits/stdc++.h>
answer.code:33:5: error: ‘cout’ was not declared in this scope
   33 |     cout<<fixed<<setprecision(10)<<ans<<"\n";
      |     ^~~~
answer.code:33:5: note: ‘std::cout’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?
answer.code:33:11: error: ‘fixed’ was not declared in this scope
   33 |     cout<<fixed<<setprecision(10)<<ans<<"\n";
      |           ^~~~~
answer.code:1:1: note: ‘std::fixed’ is defined in header ‘<ios>’; did you forget to ‘#include <ios>’?
  +++ |+#include <ios>
    1 | //#include<bits/stdc++.h>
answer.code:33:18: error: ‘setprecision’ was not declared in this scope
   33 |     cout<<fixed<<setprecision(10)<<ans<<"\n";
      |                  ^~~~~~~~~~~~
answer.code:1:1: note: ‘std::setprecision’ is defined in header ‘<iomanip>’; did you forget to ‘#include <iomanip>’?
  +++ |+#include <iomanip>
    1 | //#include<bits/stdc++.h>
answer.code: In function ‘int main()’:
answer.code:37:5: error: ‘ios’ has not been declared
   37 |     ios::sync_with_stdio(0);cin.tie(0);
      |     ^~~
answer.code:37:29: error: ‘cin’ was not declared in this scope
   37 |     ios::sync_with_stdio(0);cin.tie(0);
      |                             ^~~
answer.code:37:29: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’?