zoukankan      html  css  js  c++  java
  • Codeforces Round #350 (Div. 2) A

    Description

    On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.

    Input

    The first line of the input contains a positive integer n (1 ≤ n ≤ 1 000 000) — the number of days in a year on Mars.

    Output

    Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.

    Examples
    input
    14
    output
    4 4
    input
    2
    output
    0 2
    给我一个天数,问最少能过几个假期,最多能过几个假期~
    分情况看余数~
    讨论就好了
    #include<stdio.h>
    //#include<bits/stdc++.h>
    #include<string.h>
    #include<iostream>
    #include<stack>
    #include<math.h>
    #include<map>
    #include<sstream>
    #include<set>
    #include<queue>
    #include<vector>
    #include<algorithm>
    #include<limits.h>
    #define inf 0x3fffffff
    #define LLL l,m,rt<<1
    #define RRR r,m+1,rt<<1|1
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        if(n==1)
        {
            cout<<"0"<<" "<<"1"<<endl;
        }
        else if(2<=n&&n<=5)
        {
            cout<<"0"<<" "<<"2"<<endl;
        }
        else if(n==6)
        {
            cout<<"1"<<" "<<"2"<<endl;
        }
        else
        {
            int pot;
            int pos;
            pot=n/7*2;
            pos=n/7*2;
            if(n%7>=0&&n%7<=5)
            {
                cout<<pot<<" ";
            }
            else
            {
                cout<<pot+1<<" ";
            }
            if(n%7==1)
            {
                cout<<pos+1<<endl;
            }
            else if(n%7==0)
            {
                cout<<pos<<endl;
            }
            else
            {
                cout<<pos+2<<endl;
            }
        }
        return 0 ;
    }
    

      

  • 相关阅读:
    将excel中的数据导入到oracle数据库中
    C++学习–基础篇(书籍推荐及分享)
    Spring MVC No converter found for return value of type
    jQuery>学习
    动态建立事件
    sizeof:结构体对齐问题
    次窗体修改主窗体控件属性
    资源文件的读取和使用
    小端格式和大端格式(LittleEndian&BigEndian)
    新增控件数组
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5480867.html
Copyright © 2011-2022 走看看