Rokua-Unhappy Jinjin (upgraded version)-array

Source: Internet
Author: User

Title DescriptionDescription Jinjin on the junior high 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, every day 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.
This time, unlike the first question in the NOIp2004 group, it is assumed that Jinjin will not be unhappy with other things, but her unhappy will continue until the next day. Please help to check the Jinjin after the N-day schedule, to see if the next N days she will not be happy (method of calculation: With the amount of unhappy yesterday plus the total number of classes today minus 8 after the count as today's unhappy degree); after the output n days after the end of the unhappy degree and how much. input/output format input/output Input Format:
Line 1th: a number n
Line 2nd ~ n+1: Two numbers per line, indicating the time of school and extracurricular classes
output Format:
A number, which n days after the unhappy degree and input and Output sample sample Input/output sample Test point # # Input Sample:

7
5 3
6 2
9 |
5 3
5 4
0 4
0 6

Sample output:

-2

Idea: This question is actually not the array, each time input two number, record the degree of unhappy and unhappy degree and get.

The code is as follows:

1#include <stdio.h>2 intMain ()3 {        4     inta,w=0, n1=0, M,n; 5     intZ; 6scanf"%d",&a); 7      for(z=0; z<a;z++)        8     {  9scanf"%d%d",&m,&N); TenW=w+m+n+n1-8;  OneN1=m+n+n1-8;  A     }       -printf"%d\n", W);  -     return 0;  the}

Rokua-Unhappy Jinjin (upgraded version)-array

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.