Codeforces Beta Round 99 (Div. 2)


A. Petr and Book
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100
15 20 20 15 10 30 45
Output
6
Input
2
1 0 0 0 0 0 0
Output
1
----------------------------------------------------------------------------------------------------
B. Wallpaper
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
5 5 3
3
10 1 100
15 2 320
3 19 500
Output
640
----------------------------------------------------------------------------------------------------
C. Literature Lesson
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
day
may
sun
fun
Output
aabb
Input
1 1
day
may
gray
way
Output
aaaa
Input
2 1
a
a
a
a
a
a
e
e
Output
aabb
Input
2 1
day
may
sun
fun
test
hill
fest
thrill
Output
NO
----------------------------------------------------------------------------------------------------
D. Digits Permutations
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
198
Output
981
819
Input
500
Output
500
500
----------------------------------------------------------------------------------------------------
E. Mushroom Gnomes - 2
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1
2 2 50 50
1 1
Output
0.5000000000
Input
2 1
2 2 50 50
4 2 50 50
3 1
Output
0.2500000000
----------------------------------------------------------------------------------------------------
