#CCBCHBAHAI0000049. Bảng mưa hai năm (Two-Year Rainfall Table)
Bảng mưa hai năm (Two-Year Rainfall Table)
Bảng mưa hai năm (Two-Year Rainfall Table)
Source: Problem Solving and Program Design in C
Version: Phuoc Hung OJ Extended
Problem
You are given monthly rainfall for two consecutive years. For year and month , let be the rainfall in millimetres.
The yearly total is
and the monthly average is
For every month , define
$$c_m= \begin{cases} -1,&r_{1,m}<r_{2,m},\\ 0,&r_{1,m}=r_{2,m},\\ 1,&r_{1,m}>r_{2,m}. \end{cases}$$Compute and .
Input
The first line contains 12 integers . The second line contains 12 integers .
Output
Line 1 prints and . Line 2 prints and . Each average must be printed with exactly 6 digits after the decimal point. Line 3 prints .
Subtask
Subtask 1 (100 points): .
Example
Input
10 20 30 40 50 60 70 80 90 100 110 120
15 15 35 35 55 55 75 75 95 95 115 115
Output
780 65.000000
780 65.000000
-1 1 -1 1 -1 1 -1 1 -1 1 -1 1
Explanation
Both years total mm and average mm/month. In month 1, year 1 has less rain so ; in month 2, year 1 has more rain so ; the same alternating pattern continues.