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
给我一个天数,问最少能过几个假期,最多能过几个假期~
分情况看余数~
讨论就好了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~