QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#318659#7606. Digital Nimarnold518WA 2ms4144kbC++171.5kb2024-01-31 16:40:532024-01-31 16:40:54

Judging History

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

  • [2024-01-31 16:40:54]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:4144kb
  • [2024-01-31 16:40:53]
  • 提交

answer

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int TC;
ll N;

int dp[20][20][200];
ll P[20];

int main()
{    
    P[0]=1;
    for(int i=1; i<=18; i++) P[i]=P[i-1]*10;
    for(int i=0; i<20; i++) for(int j=0; j<20; j++) for(int k=0; k<200; k++) dp[i][j][k]=1;
    for(int i=0; i<=18; i++)
    {
        for(int j=0; j<=180; j++)
        {
            if(i<=j/10) dp[0][i][j]=i+1;
            else dp[0][i][j]=1;
        }
    }
    for(int i=1; i<=18; i++)
    {
        for(int j=0; j<=18; j++)
        {
            for(int k=0; k<=180; k++)
            {
                int val=j;
                for(int p=0; p<10; p++)
                {
                    val=dp[i-1][val][k+p];
                }
                dp[i][j][k]=val;
            }
        }
    }
    scanf("%d", &TC);
    while(TC--)
    {
        scanf("%lld", &N);
        if(N%10) printf("Algosia\n");
        else
        {
            N/=10; N++;
            int val=19, sum=0;
            for(int i=18; i>=0; i--)
            {
                while(P[i]<=N)
                {
                    //printf("%d %d %d : %d\n", i, val, sum, dp[i][val][sum]);
                    val=dp[i][val][sum];
                    sum++;
                    N-=P[i];
                }
            }
            if(val==1) printf("Bajtek\n");
            else printf("Algosia\n");
        }
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4144kb

input:

4
1
10
42
190

output:

Algosia
Bajtek
Algosia
Algosia

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 4064kb

input:

1
1

output:

Algosia

result:

ok single line: 'Algosia'

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 4128kb

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 990th lines differ - expected: 'Algosia', found: 'Bajtek'