# oi-writeup

## CodeForce 1328

A. Divisibility Problem

B. K-th Beautiful String

For the given integer n (n>2) let’s write down all the strings of length nn which contain n−2 letters ‘a’ and two letters ‘b’ in lexicographical (alphabetical) order.

C. Ternary XOR

Your task is to find such ternary numbers a and b both of length n and both without leading zeros that a⊙b=x and max(a,b) is the minimum possible.

D. Carousel

E. Tree Queries

F. Make k Equal

## abc160

Find the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.

## 51node

\begin{aligned} n !&=(5 k+r)(5 k+r-1)\cdots5\cdots4! \\ &=(5k)(5k-1)(5)\cdot m \\ &=5^{k}\times k! \times m \end{aligned}

$f(n!) = k + f(n!) \quad k = n/5$

## hdu

pid:6312