Problem Solving report Codeforces Round #350 (Div. 2) __codeforces

Source: Internet
Author: User

Topic link a.holidays (codeforces 670A) train of Thought

First, if 7 7 can divide n, the minimum vacation days M1 M1 and the maximum vacation days m2 m2 are equal to 2xn7 2 \times \frac{n}{7}. "Divide" prompts us to classify n n divided by the remainder of 7 7: The remainder is 0 0, m1=m2=2xn7 m1 = m2 = 2 \times \frac{n}{7}. The remainder is 1 1, considering the extra day is not the weekend, m1=2xn7,m2=2xn7+1 m1 = 2 \times \frac{n}{7}, m2 = 2 \times \frac{n}{7} + 1. The remainder is 6 6, consider the extra 6 days must have weekend, consider 1 days weekend or 2 days weekend, m1=2xn7+1,m2=2xn7+2 m1 = 2 \times \frac{n}{7} + 1, m2 = 2 \times \frac{n}{7} + 2. Other remainder, consider whether there is a weekend of extra days, m1=2xn7,m2=2xn7+2 m1 = 2 \times \frac{n}{7}, m2 = 2 \times \frac{n}{7} + 2. Code

#include <bits/stdc++.h>
using namespace std;

int N, T, D, M1, M2;

int main () {
    scanf ("%d", &n);
    t = N/7;
    d = n% 7;
    if (d = = 0) {
        m1 = 2 * t;
        m2 = 2 * t;
    }
    else if (d = = 1) {
        M1 = 2 * t;
        m2 = 2 * t + 1;
    }
    else if (d = = 6) {
        M1 = 2 * t + 1;
        m2 = 2 * t + 2;
    }
    else {
        M1 = 2 * t;
        m2 = 2 * t + 2;
    }
    printf ("%d%d\n", M1, M2);
    return 0;
}
B. Game of Robots (codeforces 670B) train of Thought

This problem is equivalent to having n n individuals, everyone should count off. I am going to quote from 1 1 to

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.