Submission #1130199


Source Code Expand

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

long double dp[300][1800];
signed main() {
    int n; cin >> n;
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 10000;
    rep(i,0,n) {
        rep(j,0,1800) {
            repq(k,1,6) {
                if(j-k < 0) continue;
                dp[i+1][j] += dp[i][j-k] / 6.0;
            }
        }
    }

    pair<long double, int> ans = pii(-1, -1);
    rep(i,1,1800) {
        if(ans.fr < dp[n][i]) ans = make_pair(dp[n][i], i);
    }
    cout << ans.sc << endl;
    // printf("debug: ans.frr = %lf\n", ans.fr);
    return 0;
}

Submission Info

Submission Time
Task B - ダイスゲーム
User tsutaj
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1980 Byte
Status WA
Exec Time 15 ms
Memory 8704 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 2
WA × 1
AC × 15
WA × 4
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 4 ms 8704 KB
01-02.txt AC 4 ms 8704 KB
01-03.txt AC 4 ms 8704 KB
01-04.txt WA 4 ms 8704 KB
01-05.txt AC 4 ms 8704 KB
01-06.txt WA 4 ms 8704 KB
01-07.txt AC 4 ms 8704 KB
01-08.txt AC 15 ms 8704 KB
01-09.txt AC 15 ms 8704 KB
01-10.txt AC 8 ms 8704 KB
01-11.txt AC 6 ms 8704 KB
01-12.txt AC 12 ms 8704 KB
01-13.txt AC 9 ms 8704 KB
sample-01.txt AC 4 ms 8704 KB
sample-02.txt WA 4 ms 8704 KB
sample-03.txt AC 4 ms 8704 KB