2004 Unhappy Jinjin

Source: Internet
Author: User

Title Description 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.

Enter a description Input Description

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 10, separated by spaces, indicating Jinjin's time in school and her mother's schedule for the class.

Output description Output Description

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 Sample Input

5 3

6 2

7 2

5 3

5 4

0 4

0 6

Sample output Sample Output

3

Data range and Tips Data Size & Hint

Exercises

Simulation.

Judge each Tianjin Jin tired not tired, tired words have more than before the most tired day.

var i,x,y,s,ans,c:longint;

Begin

For I:=1 to 7 do

Begin

Read (x, y);

s:=x+y-8;

If S>0 Then

If Ans<s Then

Begin

C:=i;

Ans:=s;

End

End

Write (c);

End.

2004 Unhappy Jinjin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.