Problem Description
Jinjin on the middle school. Mother think Jinjin should study harder, so jinjin in addition to school, but also to participate in the mother for her to enroll in the various subjects review class. In addition, the weekly mother will send her to learn recitation, dance and piano. But Jinjin would be unhappy if he had been in school for more than eight hours a day, and the longer he would be unhappy. Suppose Jinjin not be unhappy with anything else, and her unhappy will not last until the next day. Please check the schedule of Jinjin next week to see if she will be unhappy next week, and if so, which day is the most unhappy.
Input
The input includes seven rows of data, representing the schedule from Monday to Sunday, respectively. Each line consists of two non-negative integers less than ten , separated by spaces, indicating Jinjin's time in school and her mother's schedule for the class.
Output
The output includes one row, which contains only a single number. If not unhappy then output 0, if the output is the most unhappy is the number of weeks (with 1, 2, 3, 4, 5, 6, 7 respectively represents Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday). If there are two or two days above the level of unhappy, then the output time is the most forward day.
Sample Input
5 36 27 25 35 40 40 6
Sample Output
3
1#include <stdio.h>2 intMain ()3 {4 intA,b,max,maxday;5max=0, maxday=0;6 for(intI=0;i<7; i++)7 {8scanf"%d%d",&a,&b);9 if(a+b>8&&a+b>max)Ten{max=a+b;maxday=i+1;} One } Aprintf"%d\n", maxday); - return 1; -}
Wuhan University of Science and Technology acm:1007: Unhappy Jinjin