QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#479839#81. Hold or Continue?NOI_AK_ME#AC ✓50ms7256kbC++17932b2024-07-15 21:08:422024-07-15 21:08:42

Judging History

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

  • [2024-07-15 21:08:42]
  • 评测
  • 测评结果:AC
  • 用时:50ms
  • 内存:7256kb
  • [2024-07-15 21:08:42]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
double solution[76][76][76];
double p_hold(int i, int j, int k) { return 1 - solution[j][i + k][0]; }

double p_continue(int i, int j, int k) {
  double ret = 0;

  for (int dice = 1; dice <= 6; dice++) {
    if (dice == 1 || i + k + dice > 75)
      ret += 1 - solution[j][i][0];
    else
      ret += solution[i][j][k + dice];
  }
  return ret / 6;
}

int main() {
  int q, C, H, X, iter = 35;

  while (iter--) {
    for (int i = 0; i < 75; i++) {
      for (int j = 0; j < 75; j++) {
        for (int k = 75 - i; k >= 0; k--) {
          solution[i][j][k] = max(p_hold(i, j, k), p_continue(i, j, k));
        }
      }
    }
  }

  while (scanf("%d", &q) == 1) {
    while (q--) {
      scanf("%d %d %d", &C, &H, &X);
      double h = p_hold(C, H, X);
      double c = p_continue(C, H, X);

      printf("%c\n", h > c ? 'H' : 'C');
    }
  }
}

詳細信息

Test #1:

score: 100
Accepted
time: 46ms
memory: 7256kb

input:

3
15 0 3
35 50 40
15 0 30

output:

C
H
H

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 46ms
memory: 7208kb

input:

1000
5 0 27
19 16 28
29 41 30
29 18 26
32 24 26
21 62 32
18 64 36
14 31 31
3 66 37
18 55 31
34 30 26
12 45 32
23 38 27
28 37 27
35 13 26
3 22 30
30 27 27
11 50 33
36 3 23
25 45 31
16 26 30
21 57 36
24 73 40
24 72 40
25 42 28
31 36 30
25 44 29
60 63 10
27 46 33
7 43 34
5 69 48
11 25 31
20 19 28
7 69 ...

output:

H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
H
...

result:

ok 1000 lines

Test #3:

score: 0
Accepted
time: 50ms
memory: 7136kb

input:

1000
8 36 60
4 60 69
26 41 26
50 38 4
35 3 31
9 55 25
3 31 50
27 27 18
5 7 2
45 10 7
9 38 29
49 46 15
0 4 67
37 61 6
21 12 33
36 26 12
44 11 29
25 44 20
23 11 13
33 37 14
14 61 30
50 18 12
4 32 5
31 27 9
44 59 9
21 61 46
23 73 31
40 62 27
9 25 18
39 12 22
26 1 10
34 16 4
6 4 7
0 30 38
15 38 23
0 49 ...

output:

H
H
H
C
H
C
H
C
C
C
H
C
H
C
H
C
H
C
C
C
H
C
C
C
C
H
H
C
C
H
C
C
C
H
C
H
C
H
C
H
H
C
H
C
H
C
C
C
C
C
H
H
C
H
H
H
H
H
C
H
C
H
C
H
H
C
C
C
C
C
C
C
H
C
H
C
H
H
C
H
H
C
H
H
H
H
H
C
H
C
C
C
C
H
C
C
H
C
H
H
C
H
C
H
C
C
C
H
H
H
H
H
H
C
C
H
C
H
H
C
H
C
C
C
C
H
C
C
C
H
C
C
H
C
H
H
H
C
H
H
H
C
C
C
H
H
C
H
C
H
...

result:

ok 1000 lines