Educational Codeforces Round 116 ABCE Solutions (Java/C++)
A. AB Balance
Solution:
Obviously, if the beginning and ending letters are the same letter, AB(s) must be equal to BA(s).
Code:
Java
C++
B. Update Files
Solution:
Before running out of k patch cables, copy as many files as there are computers. If there are more than k computers with files, just copy k files at a time.
Code:
Java
C++
C. Banknotes
Solution:
Obviously, we want to use the lower bits as much as possible. Therefore, we calculate the corresponding available[i] according to the values of a[i] and a[i+1]: $available[i]=10^{a[i+1]-a[i]}-1$.
Take a[2]=3, a[3]=5 as an example, then 1000 can use up to 99 banknotes. Once 100 banknotes are used, they can be replaced with one banknote of 100,000.
But for a[1], although available[i]=999, because it can't be represented, only available[1]-1 can be used at most for i=1.
In addition, if available[1] itself is larger than k, then k banknotes of 1 can be used directly.
Code:
Java
C++
E. Arena
The final time complexity of this problem can be directly inferred based on the scale of its data, so the solution can be naturally thought of.