题目链接:http://codeforces.com/contest/670/problem/A

题意:给n天,问这n天最少和最多有多少个休息日,不用区分平闰年。

这题写几个例子,YY一下就构造出来解了。

首先注意到了n是7的倍数的时候,无论从周几开始总会轮回回去,因此休息日最多最少是相同的。

n是1的时候要特判,结果是0和1就不多说了。

对于一般情况,需要注意的就是两头有一天的情况了,(比如n=8,最少有2个休息日,最多有3个)

 /*
━━━━━┒ギリギリ♂ eye!
┓┏┓┏┓┃キリキリ♂ mind!
┛┗┛┗┛┃\○/
┓┏┓┏┓┃ /
┛┗┛┗┛┃ノ)
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┛┗┛┗┛┃
┓┏┓┏┓┃
┃┃┃┃┃┃
┻┻┻┻┻┻
*/
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <ctime>
#include <set>
#include <map>
#include <cmath>
using namespace std;
#define fr first
#define sc second
#define cl clear
#define BUG puts("here!!!")
#define W(a) while(a--)
#define pb(a) push_back(a)
#define Rlf(a) scanf("%lf", &a);
#define Rint(a) scanf("%d", &a)
#define Rll(a) scanf("%I64d", &a)
#define Rs(a) scanf("%s", a)
#define Cin(a) cin >> a
#define FRead() freopen("in", "r", stdin)
#define FWrite() freopen("out", "w", stdout)
#define Rep(i, len) for(int i = 0; i < (len); i++)
#define For(i, a, len) for(int i = (a); i < (len); i++)
#define Cls(a) memset((a), 0, sizeof(a))
#define Clr(a, x) memset((a), (x), sizeof(a))
#define Full(a) memset((a), 0x7f7f, sizeof(a))
#define lrt rt << 1
#define rrt rt << 1 | 1
#define pi 3.14159265359
#define RT return
#define lowbit(x) x & (-x)
#define onenum(x) __builtin_popcount(x)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef map<string, int> msi;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb; int n; int main() {
// FRead();
while(~Rint(n)) {
if(n % == ) {
printf("%d %d\n", n / * , n / * );
continue;
}
if(n == ) {
printf("%d %d\n", , );
continue;
}
if(n % <= ) printf("%d ", n / * );
else printf("%d ", n / * + );
n -= ;
if(n % <= ) printf("%d ", n / * + );
else printf("%d ", n / * + );
}
RT ;
}

[Codeforces670A]Holidays(数学,构造)的更多相关文章

  1. 【CodeForces】708 B. Recover the String 数学构造

    [题目]B. Recover the String [题意]找到一个串s,满足其中子序列{0,0}{0,1}{1,0}{1,1}的数量分别满足给定的数a1~a4,或判断不存在.数字<=10^9, ...

  2. Codeforces 715A. Plus and Square Root[数学构造]

    A. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  3. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) D. Artsem and Saunders 数学 构造

    D. Artsem and Saunders 题目连接: http://codeforces.com/contest/765/problem/D Description Artsem has a fr ...

  4. [数学-构造矩阵]NEFU 1113

    依据题意.我已经推导出tn的公式.ti=ti.a+ti.b,ti.a=5*t(i-1).a+4*t(i-1).b,ti.b=t(i-1).a+t(i-1).b 然而以下居然不能继续推到sn的公式!!! ...

  5. UVA12716 GCD XOR 数论数学构造

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u010682557/article/details/36204645 题目给你一个N,让你求 两个数 ...

  6. [jzoj 6080] [GDOI2019模拟2019.3.23] IOer 解题报告 (数学构造)

    题目链接: https://jzoj.net/senior/#main/show/6080 题目: 题意: 给定$n,m,u,v$ 设$t_i=ui+v$ 求$\sum_{k_1+k_2+...+k_ ...

  7. [JZOJ6345]:ZYB建围墙(数学+构造)

    题目描述 $ZYB$之国是特殊的六边形构造. 已知王国一共有$N$户家庭,每个家庭需占据一个不同的六边形格子. 王国里交流很频繁,所以这些家庭要构成一个连通区域:同时出于安全考虑,国王$ZYB$想在外 ...

  8. hdu5646数学构造+二分

    /* 满足n>=(k+1)*k/2的整数n必定满足 a+(a+1)+...+(a+k-1)<=n<=(a+1)+(a+2)+...+(a+k) 只要在[a,a+k]中减掉一个数字ai ...

  9. Sonya and Matrix CodeForces - 1004D (数学,构造)

    http://codeforces.com/contest/1004/problem/D 题意:网格图给定到中心点的曼哈顿距离数组, 求该图n,m及中心点位置 首先可以观察到距离最大值mx一定在某个角 ...

随机推荐

  1. 短小强悍的JavaScript异步调用库

    对于博文 20行完成一个JavaScript模板引擎 的备受好评我感到很惊讶,并决定用此文章介绍使用我经常使用的另一个小巧实用的工具.我们知道,在浏览器中的 JavaScript 绝大部分的操作都是异 ...

  2. 0x03伪指令

    等号伪指令 = 相当于指定常量,由等号定义的符号常量不占用存储空间. count = 1234 可以重复定义多次,EQU则不容许 EQU伪指令 1.常量名 EQU 表达式 NUMBER EQU 10* ...

  3. php将数据库导出成excel的方法

    <?php $fname = $_FILES['MyFile']['name']; $do = copy($_FILES['MyFile']['tmp_name'],$fname); if ($ ...

  4. linux第四周作业

    一.用户态内核态与中断 1.库函数把内核调用封装起来. 2.区分内核态和用户态是为了让系统更稳定.Linux里吧用户态定位3级,把内核态定位0级. 3.中断处理就是从用户态进入内核态的主要方法,系统调 ...

  5. C# ASP .NET WEB方向和WPF方向,我该如何去选择

    一个2012年南航毕业学软件的学生,该如何去选择我的职业方向? 2011年11分月份,我被老师介绍在南京珠江路华丽国际大厦工作,开发一个大型国际物流平台,公司的开发人员比较少,设计网站的是高校的老师, ...

  6. html5游戏引擎-Pharse.js学习笔记(一)

    1.前言 前几天随着flappy bird这样的小游戏的火爆,使我这种也曾了解过html5技术的js业余爱好者也开始关注游戏开发.研究过两个个比较成熟的html5游戏引擎,感觉用引擎还是要方便一些.所 ...

  7. 2435: [Noi2011]道路修建 - BZOJ

    Description 在 W 星球上有 n 个国家.为了各自国家的经济发展,他们决定在各个国家之间建设双向道路使得国家之间连通.但是每个国家的国王都很吝啬,他们只愿意修建恰好 n – 1条双向道路. ...

  8. Codeforces Bubble Cup 8 - Finals [Online Mirror] B. Bribes lca

    题目链接: http://codeforces.com/contest/575/problem/B 题解: 把链u,v拆成u,lca(u,v)和v,lca(u,v)(v,lca(u,v)是倒过来的). ...

  9. Directx3D SimpleSample Sample

    在d3d 2010 june这个版本里的samples 不知道为什么SimpleSample Sample 这个 它的documents基本等于没有 Starting point for new Di ...

  10. iOS开发之ARC&MRC混用

    Xcode 项目中我们可以使用 ARC 和非 ARC 的混合模式. 如果你的项目使用的非 ARC 模式,则为 ARC 模式的代码文件加入 -fobjc-arc 标签. 如果你的项目使用的是 ARC 模 ...