题意

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

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

以及 每个月 的总天数

求出 有多少个星期五 是当月的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;
}
}

最新文章

  1. CSS浮动文摘
  2. eclipse左侧不见
  3. 在指定时间干,必须干(kbmmw 中的事件调度)
  4. openstack security group and rules python api use
  5. android Studio项目运行时报错“Could not identify launch activity: Default Activity not found”
  6. linux下如何优雅的挂载一个外界设备(比如优盘)
  7. Android中Service的使用详解和注意点(LocalService)
  8. hadoop配置优化
  9. poj3579 二分搜索+二分查找
  10. 能让汇编转到C51的初学者有更清晰的认识的一篇文章
  11. mongodb remove删除文档的用法
  12. 动手学习TCP:数据传输(转)
  13. wepy框架自定义组件编译报错not Found File XXX.wxss
  14. 关于getchar-scanf函数的相关坑!
  15. nginx 配置laravel框架域名配置
  16. 【云服务器部署】---Linux下安装nginx
  17. 初识Linux系统
  18. 指定nvm的默认版本号
  19. python numpy访问行列元素的方法
  20. ansible的安装过程 和基本使用

热门文章

  1. git个人使用总结(界面版)
  2. WebScarab安装
  3. webstore 与 热编译的配置冲突
  4. JSON-Schema 最科学的表单验证模式
  5. struts2中配置文件加载的顺序是什么?
  6. shiro自定义拦截url
  7. 集合第七发练习之利用ArrayList做栈、队列
  8. Java多线程编程总结一:多线程基本概念
  9. android-support-v4.jar异常解决方法
  10. python入门课程 第一章 课程介绍