VK Cup 2012 Round 2 (Unofficial Div. 2 Edition)


A. Chores
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2 3
6 2 3 100 1
Output
3
Input
7 3 4
1 1 9 1 1 1 1
Output
0
----------------------------------------------------------------------------------------------------
B. Replacing Digits
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1024
010
Output
1124
Input
987
1234567
Output
987
----------------------------------------------------------------------------------------------------
C. Substring and Subsequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
aa
aa
Output
5
Input
codeforces
forceofcode
Output
60
----------------------------------------------------------------------------------------------------
D. Lemmings
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3 2
1 2 3 2 1
1 2 1 2 10
Output
5 2 4
Input
5 3 10
3 4 3 2 1
5 4 3 2 1
Output
4 3 1
----------------------------------------------------------------------------------------------------
E. Conveyor
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1 1
0
Output
0.75000000000000000000
0.25000000000000000000
Input
2 3 1 2
2 5
Output
0.33333333333333331000
0.66666666666666663000
0.00000000000000000000
----------------------------------------------------------------------------------------------------
