题目链接: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. Daject初探之Record模型

    上一篇博文我简单介绍了Daject以及Daject的Table模型,Table模型是对一张数据表的抽象,从数据表的级别处理数据,而Record模型是对单条数据记录的抽象,从记录的级别处理数据. 这一篇 ...

  2. 开发中/listfile.jsp(11,31) quote symbol expected 这个错误

    可能是因为11行33列,少了一个引号.

  3. CoreLocation MKMapView 地图

    系统自带地图  框架: CoreLocation MapKit CLLocationManager --> 定位管理者  CLGeocoder --> 地理编码器 MKMapView -- ...

  4. c++ linux 下的调试工具及用法

    1当程序出现core的时候: gdb out[your program] core.out.45726.1431954543 可以看到程序崩溃时候的堆栈信息. valgrind ./out 由于val ...

  5. qsort/bsearch的应用

    问题描述: Description You have just moved from Waterloo to a big city. The people here speak an incompre ...

  6. HTML特殊转义字符对照表

    字符 十进制 转义字符 字符 十进制 转义字符 字符 十进制 转义字符 ? ¡ ¡ Á Á Á á á á ¢ ¢ ¢ Â Â ˆ â â £ £ £ Ã Ã Ã ã ã ã ¤ ¤ ¤ Ä Ä &a ...

  7. spring mvc 经典总结

    概述 继 Spring 2.0 对 Spring MVC 进行重大升级后,Spring 2.5 又为 Spring MVC 引入了注解驱动功能.现在你无须让 Controller 继承任何接口,无需在 ...

  8. httpClient 入门实例

    import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.Unsu ...

  9. 如何通过热修复,搞定开发中的那些 Bug?

    作为程序员,Bug 修复终究是绕不开的话题,本期移动开发精英俱乐部讨论的主题便是 Bug 修复中的 Hotfix,即热修复.接下来让我们跟随大牛的脚步来了解 Hotfix,就算你不能一下豁然开朗,相信 ...

  10. 【leetcode】Median of Two Sorted Arrays(hard)★!!

    There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted ...