QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#371802#7606. Digital Nimucup-team134WA 9ms6272kbC++171.4kb2024-03-30 16:34:472024-03-30 16:34:47

Judging History

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

  • [2024-03-30 16:34:47]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:6272kb
  • [2024-03-30 16:34:47]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
#define ll long long
#define sz(x) (int)(x).size()
using namespace std;

const int DS=9*18+20;
int dp[DS][DS][19]; //[last][digit sum][k]

int main(){
    for(int k=0;k<19;k++){
        for(int last=0;last<DS-10;last++){
            for(int ds=0;ds<DS-10;ds++){
                int &a=dp[ds][last][k];
                if(k==0){
                    if(ds+1>=last){
                        a=last+1;
                    }
                    else{
                        a=1;
                    }
                    continue;
                }
                int tr=last;
                for(int i=1;i<10;i++){
                    tr=dp[ds-1+i][tr][k-1];
                }
                a=dp[ds+1][tr][k-1];
            }
        }
    }
    int t;
    scanf("%i",&t);
    while(t--){
        ll n;
        scanf("%lld",&n);
        vector<int> dig;
        while(n){
            dig.push_back(n%10);
            n/=10;
        }
        int k=sz(dig)-1;
        reverse(all(dig));
        int tr=1;
        int trSum=0;
        for(auto p:dig){
            for(int o=0;o<p;o++){
                tr=dp[trSum][tr][k];
                trSum++;
            }
            k--;
        }
        if(tr==1){
            printf("Bajtek\n");
        }
        else{
            printf("Algosia\n");
        }
    }
}

详细

Test #1:

score: 100
Accepted
time: 6ms
memory: 6092kb

input:

4
1
10
42
190

output:

Algosia
Bajtek
Algosia
Algosia

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 9ms
memory: 6272kb

input:

1
1

output:

Algosia

result:

ok single line: 'Algosia'

Test #3:

score: -100
Wrong Answer
time: 7ms
memory: 6052kb

input:

10000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

output:

Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Bajtek
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Bajtek
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Bajtek
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia
Algosia...

result:

wrong answer 90th lines differ - expected: 'Bajtek', found: 'Algosia'