Nyoj not happy, xiaoming.

Source: Internet
Author: User

Unhappy xiaoming time limit: theMs | Memory Limit:65535KB Difficulty:1
Describe
Xiao Ming has a problem again. The mother thinks that the clever Xiao Ming should study harder and become more powerful, so Xiao Ming in addition to school, but also to participate in his mother for his registration of the various subjects review class. In addition, the weekly mother will send him to learn recitation, dance and piano. But Xiaoming would not be happy if he had been in school for more than eight hours a day, and the longer he went, the more unhappy he would be. Suppose Xiaoming would not be unhappy with other things, and her unhappy will not last until the next day. Please help to check Xiao Ming's schedule next week to see if he will be unhappy next week, and if so, which day is the most unhappy.
Input
The first line of input N (0<n<100) represents the number of test data groups, followed by each set of test data inputs consisting of 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
each set of test data 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 weeks (with 1,2,3,4,5,6,7 respectively for 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
15 36 27 25 35 40 40 6
Sample output
3
#include <cstdio> #include <cstdlib> #include <cstring>using namespace Std;int main () {int i,k,n,a,b, MAX,DAY,FLAG;SCANF ("%d", &k), while (k--) {flag=max=0;for (i=1;i<=7;++i) {scanf ("%d%d", &a,&b); if (a+b >8) flag=1;if (max<a+b) {max=a+b;day=i;}} if (flag) printf ("%d\n", day), Else printf ("0\n");} return 0;}

Nyoj not happy, xiaoming.

Related Article

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.