标签:
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.
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.
Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.
14
4 4
2
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 ; }
Codeforces Round #350 (Div. 2) A
标签:
原文地址:http://www.cnblogs.com/yinghualuowu/p/5480867.html