QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#629422#7606. Digital NimguodongWA 8ms11432kbC++14839b2024-10-11 11:28:462024-10-11 11:28:47

Judging History

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

  • [2024-10-11 11:28:47]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:11432kb
  • [2024-10-11 11:28:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int F[22][300][300];
int A[300];
int Dfs(int dep,int lstans,int ds,int lim){
	if(dep == 0){
		if(lstans + 1 <= ds) return lstans + 1;
		return 0;
	}
	int mx = lim == 1 ? A[dep] : 9;
	if(lim == 0 && F[dep][ds][lim] != -1)
		return F[dep][ds][lim];
	int now = lstans;
	for(int i = 0; i <= mx; ++i){
		now = Dfs(dep - 1, now, ds + i, lim && i == mx);
	}
	if(lim == 0) 
		F[dep][ds][lim] = now;
	return now;
}
signed main(){
#ifdef NICEGUODONG
	freopen("data.in","r",stdin);
#endif
	memset(F,-1,sizeof F);
	int T;
	cin >> T;
	while(T--){
		int n;
		cin >> n;
		int cnt = 0;
		while(n){
			A[++cnt] = n % 10;
			n /= 10;
		}
		int res = Dfs(cnt,0,0,1);
		if(res == 0){
			cout << "Bajtek" << '\n';
		}
		else 
			cout << "Algosia" << '\n';
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 11432kb

input:

4
1
10
42
190

output:

Algosia
Bajtek
Algosia
Algosia

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 11368kb

input:

1
1

output:

Algosia

result:

ok single line: 'Algosia'

Test #3:

score: -100
Wrong Answer
time: 8ms
memory: 11300kb

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