Technocup 2017 - Elimination Round 1

Chong Wang Lv6

I recently participated in Hackx_FDU held by Fudan University, and I gained a lot~ I saw many great people, and I was amazed that a group of people can write such wonderful code in a short time.

I played this Technocup for two hours during the Hackx competition without eating dinner. . . However, the effect is very bad. . . My head felt sleepy, and I was also quite anxious. . . Question B is about accuracy. . . Question C has also been brain-dead for a long time. . . Just got out. . .

Title link and Code link

A Transformation: from A to B

A number can be multiplied by $2$ or $10+1$. Ask about the solution from $A$ to $B$.

Wide search.

B Bill Total Value

The meaning of the question is to give a string containing the price of each item. If there are two digits after the decimal point, it means it is a decimal. If it has three digits, it is an integer. Ask for the total price.

The accuracy is inexplicably stuck. . . It runs OK locally and is always WA when submitted. Next, multiply this situation directly by 100 and replace it with integer operation. . .

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
char x[maxn];

void solve()
{
scanf("%s", x + 1);
ll res = 0;
for (int i = 1; x[i]; i++)
{
if (isalpha(x[i]))continue;
ll t = 0;
int dot = -1;
while (x[i]&&!isalpha(x[i]))
{
if (x[i] == '.')
{
dot = i;
}
else
{
t = t * 10 + x[i] - '0';
}
i++;
}
if (dot == -1 || i - dot == 4)
{
t *= 100;
}
res += t;
i--;
}
if (res < 100)
{
printf("0.%02lld\n", res);
return;
}
vector<int>r;
while (res)
{
r.push_back(res % 10);
res /= 10;
}
reverse(r.begin(), r.end());

for (int i = 0; i < r.size()-2; i++)
{
printf("%d", r[i]);
if ((r.size() - 2 - (i+1)) % 3 == 0 && i != r.size() - 3)
{
printf(".");
}
}
if (r[r.size() - 1] == 0 && r[r.size() - 2] == 0)
{
return;
}
else
{
printf(".%d%d\n", r[r.size() - 2], r[r.size() - 1]);
}
}

C Guess the Array

The meaning of the question is that for an array with a length of $N$, you can ask the sum between two elements of $N$. Finally output this array.

Also retarded. . . The idea has always been dead, asking 1 2/2 3/3 4/../n..1, but in fact this can be deduced in the end, which means there are many solutions. . So directly find 12/ 2 3/ 3 1. After the first three elements are removed, the remaining elements will also come out. . Really retarded. . . WA 5 times, finally got it.

D T-shirts Distribution

Everyone can have a fixed size of clothes, or they can choose between two models (the two models must be adjacent). Now give the quantities of 6 types of clothes and ask about the distribution of clothes.

Water question. . Start greedy directly from the smallest one. .

E Games on a CD

The length of each name is equal. Now $g$ strings are given. Select $n$ from these $g$ strings. If you go clockwise, you can form the given characters. .

AC automata, because the lengths are equal, cannot be covered, so just run it again to see if there are repetitions + enough quantity in the end.

F Polycarp’s problems

Given an array $a_i$ with a length of $n$, and then the starting value is $b_i$, it is required that when the starting value is $b_i$, when it encounters a $a_i$, it is added, but it cannot be less than or equal to 0. How many values should be removed in the end. Now there are m queries, and for each $b_i$, the minimum quantity to be removed is required.

Divide into two parts to get the minimum value required from $1$ to $n$, and then divide it into two parts again in the result.