7.14 _ B Question, 7.14 what is Valentine's Day

Source: Internet
Author: User

7.14 _ B Question, 7.14 what is Valentine's Day
B. xuejie to learn the car time limit 1000 MS memory limit 65536 KB Title Description

During the holiday, xuejie went to learn the car to take the younger brother for a ride. However, it is really hard to get up and catch the shuttle bus at half past five every day, but xuejie's coaches work harder. They need the same time and day. So gentle xuejie asked her about their rest, and the coach told her that the two of them had switched to the teaching elder sister. N If a coach has a day off, another coach will take the day off, and the other coach will take the day off until the day ends. Now, xuejie wants to know which coach teaches her every day.

Input Format

Start with the number of data groups T (T ≤ 10) Next T Group input, first act N, m Assume that the first day of teaching is Coach 1, and the last day of his teaching sister has just completed the leave, Coach 2 will M Day off, 1 ≤ m ≤ n To ensure that there is a coach and teaching sister every day. The next line is Q (q ≤ 103) , That is, the number of inquiries, and then Q Line Ti It means that xuejie wants to ask who the coach is. Because the coaches are very good, and xuejie does not know how long it will take to finish learning the car, your program will deal with it. N, m, ti The upper limit is 109 .

Output Format

For each query Ti , Output a line, 1 or 2 represents the coach of the day.

Input example
15 336913
Output example
212

It is very easy to find regular questions. You only need to draw a duty schedule on paper to find a large physical fitness cycle. However, the first cycle is a special case, which is different from the subsequent one.

Code:

#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std; int main(){    int t;    scanf("%d",&t);    while(t--)    {        int n,m;        scanf("%d%d",&n,&m);        int c;        scanf("%d",&c);        for(int i=0;i<c;i++)        {            int q;            scanf("%d",&q);            int temp=q%(2*(n+1));            if(temp==0)                printf("2\n");            else if(temp<m+n+1&&temp>=n+1)                printf("2\n");            else if(temp<m&&q>(2*(n+1)))                printf("2\n");            else                printf("1\n");        }    }    return 0;}



Number of rows in the test series question, 2, () Space: A, 10 B, 20 C, 30 D, 40

Select A, 10
This series does not have a general formula. But there are rules to follow
It is not difficult to observe that there is a multiplier relationship between 1 and 1, 7 and 14, 6 and 18, 3 and 12, and the multiples are 1, 2, 3, 4 .... So it is not difficult to infer that the subsequent number should be 5 times of 2, that is, 10, select

Maintenance of asphalt emulsion and seal layer for several days d? For example, 7-14d.

1d should be okay. When the temperature is high, it will take a few hours.
 

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.