dwangoプログラミングコンテスト

Submission #8194036

Source codeソースコード

// ※※※ 解答不能 ※※※
// square1001氏.
// https://atcoder.jp/contests/dwango2015-prelims/submissions/1991686
#include <bits/stdc++.h>
using namespace std;
int n, inf = 1012345678; double comb[109][109], dp[109];
int main(){
    scanf("%d", &n);
    comb[0][0] = 1.0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            comb[i][j] = comb[i - 1][j];
            if(j >= 1) comb[i][j] += comb[i - 1][j - 1];
        }
    }
    double mul = 3.0;
    for(int i = 2; i <= n; i++){
        mul *= 3.0;
        double all = 0;
        for(int a = 0; a <= i; a++){
            for(int b = 0; a + b <= i; b++){
                int c = i - a - b;
                int d = min({ a ? a : inf, b ? b : inf, c ? c : inf });
                double s = comb[i][a] * comb[i - a][b];
                if((a == 0) + (b == 0) + (c == 0) == 2 || (d == a && d == b && d == c)) all += s;
                else                                                                    dp[i] += dp[d] * s;
            }
        }
        dp[i] /= mul - all;
        dp[i] += mul / (mul - all);
    }
    printf("%.15lf\n", dp[n]);
    return 0;
}

Submission

Task問題 C - ゲーマーじゃんけん
User nameユーザ名 at_abcde
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1189 Byte
File nameファイル名
Exec time実行時間 2 ms
Memory usageメモリ使用量 384 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:8:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 input-002.txt,input-003.txt,input-004.txt,input-005.txt,input-006.txt,input-007.txt,input-008.txt,input-009.txt,input-010.txt,input-011.txt,input-012.txt,input-013.txt,input-014.txt,input-015.txt,input-016.txt,input-017.txt,input-018.txt,input-019.txt,input-020.txt,input-021.txt,input-022.txt,input-023.txt,input-024.txt,input-025.txt,input-026.txt,input-027.txt,input-028.txt,input-029.txt,input-030.txt,input-031.txt,input-032.txt,input-033.txt,input-034.txt,input-035.txt,input-036.txt,input-037.txt,input-038.txt,input-039.txt,input-040.txt,input-041.txt,input-042.txt,input-043.txt,input-044.txt,input-045.txt,input-046.txt,input-047.txt,input-048.txt,input-049.txt,input-050.txt,input-051.txt,input-052.txt,input-053.txt,input-054.txt,input-055.txt,input-056.txt,input-057.txt,input-058.txt,input-059.txt,input-060.txt,input-061.txt,input-062.txt,input-063.txt,input-064.txt,input-065.txt,input-066.txt,input-067.txt,input-068.txt,input-069.txt,input-070.txt,input-071.txt,input-072.txt,input-073.txt,input-074.txt,input-075.txt,input-076.txt,input-077.txt,input-078.txt,input-079.txt,input-080.txt,input-081.txt,input-082.txt,input-083.txt,input-084.txt,input-085.txt,input-086.txt,input-087.txt,input-088.txt,input-089.txt,input-090.txt,input-091.txt,input-092.txt,input-093.txt,input-094.txt,input-095.txt,input-096.txt,input-097.txt,input-098.txt,input-099.txt,input-100.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
input-002.txt AC 1 ms 256 KB
input-003.txt AC 1 ms 256 KB
input-004.txt AC 1 ms 256 KB
input-005.txt AC 1 ms 256 KB
input-006.txt AC 1 ms 256 KB
input-007.txt AC 1 ms 256 KB
input-008.txt AC 1 ms 256 KB
input-009.txt AC 1 ms 256 KB
input-010.txt AC 1 ms 256 KB
input-011.txt AC 1 ms 256 KB
input-012.txt AC 1 ms 256 KB
input-013.txt AC 1 ms 256 KB
input-014.txt AC 2 ms 384 KB
input-015.txt AC 1 ms 256 KB
input-016.txt AC 1 ms 256 KB
input-017.txt AC 1 ms 256 KB
input-018.txt AC 1 ms 256 KB
input-019.txt AC 1 ms 256 KB
input-020.txt AC 1 ms 256 KB
input-021.txt AC 1 ms 256 KB
input-022.txt AC 1 ms 256 KB
input-023.txt AC 1 ms 256 KB
input-024.txt AC 1 ms 256 KB
input-025.txt AC 1 ms 256 KB
input-026.txt AC 1 ms 256 KB
input-027.txt AC 1 ms 256 KB
input-028.txt AC 1 ms 256 KB
input-029.txt AC 1 ms 256 KB
input-030.txt AC 1 ms 256 KB
input-031.txt AC 1 ms 256 KB
input-032.txt AC 1 ms 256 KB
input-033.txt AC 1 ms 256 KB
input-034.txt AC 1 ms 256 KB
input-035.txt AC 1 ms 256 KB
input-036.txt AC 1 ms 256 KB
input-037.txt AC 1 ms 256 KB
input-038.txt AC 1 ms 256 KB
input-039.txt AC 1 ms 256 KB
input-040.txt AC 1 ms 256 KB
input-041.txt AC 1 ms 256 KB
input-042.txt AC 1 ms 256 KB
input-043.txt AC 1 ms 256 KB
input-044.txt AC 1 ms 256 KB
input-045.txt AC 1 ms 256 KB
input-046.txt AC 1 ms 256 KB
input-047.txt AC 1 ms 256 KB
input-048.txt AC 1 ms 256 KB
input-049.txt AC 1 ms 256 KB
input-050.txt AC 1 ms 256 KB
input-051.txt AC 1 ms 256 KB
input-052.txt AC 1 ms 256 KB
input-053.txt AC 1 ms 256 KB
input-054.txt AC 1 ms 256 KB
input-055.txt AC 1 ms 256 KB
input-056.txt AC 1 ms 256 KB
input-057.txt AC 1 ms 256 KB
input-058.txt AC 1 ms 256 KB
input-059.txt AC 1 ms 256 KB
input-060.txt AC 1 ms 256 KB
input-061.txt AC 1 ms 256 KB
input-062.txt AC 1 ms 256 KB
input-063.txt AC 1 ms 256 KB
input-064.txt AC 1 ms 256 KB
input-065.txt AC 1 ms 256 KB
input-066.txt AC 1 ms 256 KB
input-067.txt AC 1 ms 256 KB
input-068.txt AC 1 ms 256 KB
input-069.txt AC 1 ms 256 KB
input-070.txt AC 1 ms 256 KB
input-071.txt AC 1 ms 256 KB
input-072.txt AC 1 ms 256 KB
input-073.txt AC 1 ms 256 KB
input-074.txt AC 1 ms 256 KB
input-075.txt AC 1 ms 256 KB
input-076.txt AC 1 ms 256 KB
input-077.txt AC 2 ms 256 KB
input-078.txt AC 2 ms 256 KB
input-079.txt AC 2 ms 256 KB
input-080.txt AC 2 ms 256 KB
input-081.txt AC 2 ms 256 KB
input-082.txt AC 2 ms 256 KB
input-083.txt AC 2 ms 384 KB
input-084.txt AC 2 ms 256 KB
input-085.txt AC 2 ms 256 KB
input-086.txt AC 2 ms 256 KB
input-087.txt AC 2 ms 384 KB
input-088.txt AC 2 ms 384 KB
input-089.txt AC 2 ms 384 KB
input-090.txt AC 2 ms 384 KB
input-091.txt AC 2 ms 384 KB
input-092.txt AC 2 ms 384 KB
input-093.txt AC 2 ms 384 KB
input-094.txt AC 2 ms 384 KB
input-095.txt AC 2 ms 384 KB
input-096.txt AC 2 ms 384 KB
input-097.txt AC 2 ms 384 KB
input-098.txt AC 2 ms 384 KB
input-099.txt AC 2 ms 384 KB
input-100.txt AC 2 ms 384 KB