-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path10415.cpp
More file actions
87 lines (74 loc) · 1.61 KB
/
10415.cpp
File metadata and controls
87 lines (74 loc) · 1.61 KB
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
#include <iostream>
#include <cstdint>
#include <string>
using namespace std;
const bool fingers[16][11] =
{
{0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1},
{0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0},
{0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0},
{0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0},
{0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
};
const string index = "cdefgabCDEFGAB";
string input;
int64_t changeCount[11];
void solve();
void prepare();
void calc();
int main() {
int64_t cases;
cin >> cases;
cin.ignore();
for (int64_t i = 0; i < cases; i++) {
solve();
}
return 0;
}
void prepare() {
for (int64_t i = 1; i <= 10; i++) {
changeCount[i] = 0;
}
}
void solve() {
prepare();
getline(cin, input);
calc();
for (int64_t i = 1; i < 10; i++) {
cout << changeCount[i] << " ";;
}
cout << changeCount[10] << endl;
}
void calc() {
int64_t currentNote = 15;
int64_t prevNote = 15;
for (int64_t i = 0; i < input.size(); i++) {
for (int64_t j = 0; j <= index.size(); j++) {
if (input[i] == index[j]) {
currentNote = j;
break;
}
}
if (i == 0) {
for (int64_t j = 1; j <= 10; j++) {
changeCount[j] += fingers[currentNote][j];
}
} else {
for (int64_t j = 1; j <= 10; j++) {
if ((fingers[prevNote][j] - fingers[currentNote][j]) == -1) {
changeCount[j]++;
}
}
}
prevNote = currentNote;
}
}