题意

每一年的第一天 都是星期天

然后 给出 一年的总天数 和 总月数

以及 每个月 的总天数

求出 有多少个星期五 是当月的13号

思路

对于 每个月 只要判断 当月的13号 是不是 星期五 就可以了

那么 给出 一个 第几天 怎么判断 是星期几呢

因为 每年的第一天 都是星期天

所以 我们可以 依次 另 星期天 到 星期六 为 0-6

然后 给出第几天(tot) 我们 只要 用(tot - 1) % 7 来判断 就可以了

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <climits>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll; const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6; const int INF = 0x3f3f3f3f;
const int maxn = 1e3 + 5;
const int MOD = 1e9 + 7; int main()
{
int t;
cin >> t;
while (t--)
{
int d, m;
scanf("%d%d", &d, &m);
int ans = 0;
int tot = 0;
for (int i = 0; i < m; i++)
{
scanf("%d", &d);
if ((tot + 12) % 7 == 5 && d >= 13)
ans++;
tot += d;
}
cout << ans << endl;
}
}

Kattis - friday 【数学】的更多相关文章

  1. Kattis - wheretolive 【数学--求质心】

    Kattis - wheretolive [数学] Description Moving to a new town can be difficult. Finding a good place to ...

  2. Kattis - amsterdamdistance【数学】

    Kattis - amsterdamdistance[数学] 题意 给出两个点 算出从第一个点到第二个点的最短距离,只不过这里不是直角坐标系, 是雷达图 思路 因为内圈的圆的路径要比外圈的小,所以我们 ...

  3. A - Piece of Cake Kattis - pieceofcake (数学)

    题目链接: A - Piece of Cake Kattis - pieceofcake 题目大意:给你一个多边形,然后给你这个多边形的每个点的坐标,让你从这个n个点中选出k个点,问这个k个点形成的面 ...

  4. Kattis - convexpolygonarea 【数学】

    题意 给出一系列点,求这个多边形面积 思路 向量叉积 AC代码 #include <cstdio> #include <cstring> #include <ctype. ...

  5. Kattis - triangle 【数学】

    题意 求第N个迭代三角形 中 所有黑色三角形的周长的整数部分的位数 思路 该三角形的周长是 3^(n + 1)/ 2 ^ (n) 然后 可以用 long double 存下来 再求位数 就可以 AC ...

  6. 数学思想:为何我们把 x²读作x平方

    要弄清楚这个问题,我们得先认识一个人.古希腊大数学家 欧多克索斯,其在整个古代仅次于阿基米德,是一位天文学家.医生.几何学家.立法家和地理学家. 为何我们把 x²读作x平方呢? 古希腊时代,越来越多的 ...

  7. 速算1/Sqrt(x)背后的数学原理

    概述 平方根倒数速算法,是用于快速计算1/Sqrt(x)的值的一种算法,在这里x需取符合IEEE 754标准格式的32位正浮点数.让我们先来看这段代码: float Q_rsqrt( float nu ...

  8. MarkDown+LaTex 数学内容编辑样例收集

    $\color{green}{MarkDown+LaTex 数学内容编辑样例收集}$ 1.大小标题的居中,大小,颜色 [例1] $\color{Blue}{一元二次方程根的分布}$ $\color{R ...

  9. 深度学习笔记——PCA原理与数学推倒详解

    PCA目的:这里举个例子,如果假设我有m个点,{x(1),...,x(m)},那么我要将它们存在我的内存中,或者要对着m个点进行一次机器学习,但是这m个点的维度太大了,如果要进行机器学习的话参数太多, ...

随机推荐

  1. git 4种对象的理解

    git中有四种基本对象类型,可以说Git的所有操作都是通过这四种对象完成的.下图是<Git版本控制管理>中文第二版的原话,顺便吐槽一下,这本书真的翻译的一般.. 下面说下我的理解吧,首先b ...

  2. VBA 按列查找小工具类似lookUp函数

    如上图,查找A列的数据在D,F列是否存在,如果存在背景色变绿,如果不存在则A列的背景色变红. 直接贴上代码: Private Sub CommandButton1_Click() Call lookU ...

  3. TouchSlide - 大话主席

    http://www.superslide2.com/TouchSlide/downLoad.html 首  页如何使用查看参数案例演示下载页面交流反馈SuperSlide TouchSlide - ...

  4. oracle查询当前会话数量

    SELECT a.inst_id,sid,username,event,sql_id,a.PROGRAM FROM gv$session a WHERE a.STATUS='ACTIVE' AND u ...

  5. MapReduce源码分析之InputFormat

    InputFormat描述了一个Map-Reduce作业中的输入规范.Map-Reduce框架依靠作业的InputFormat实现以下内容: 1.校验作业的输入规范: 2.分割输入文件(可能为多个), ...

  6. Google Code Jam 资格赛: Problem A. Magic Trick

    Note: To advance to the next rounds, you will need to score 25 points. Solving just this problem wil ...

  7. Nginx 配置指令的执行顺序

    在一个 location 中使用 content 阶段指令时,通常情况下就是对应的 Nginx 模块注册该 location 中的“内容处理程序”.那么当一个 location 中未使用任何 cont ...

  8. 自动改变html font-size,实现移动端rem适配

    移动端采用rem适配非常方便 比如在iphone6尺寸下,将html font-size 设置为 100px,那么写css时,只要将尺寸/100 + rem 即可. 在iphone6Plus尺寸下,h ...

  9. X264使用指南

    x264是一个开源的H.264视频编码器库.是目前最好的有损视频编码器. 基本用法是 x264 [options]-o outfile infile 主页: http://www.videolan.o ...

  10. iOS 蓝牙功能 bluetooth

    现将创建蓝牙工程的要点总结一下,由于工程主要涉及中心模式,所以只总结中心模式的用法 1,引入CoreBluetooth.framework 2,实现蓝牙协议,如: .h文件如下 @protocol C ...