注意闰月的部分细节很多。

/*
ID:Starry21
LANG:C++
TASK:friday
*/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
#define N 405
int n;
int ans[];
int main()
{
//freopen("friday.in","r",stdin);
//freopen("friday.out","w",stdout);
scanf("%d",&n);
int lw=,m,d=,r;
for(int i=;i<=n;i++)
{
int y=+i-;
if(y%==)
{
if(y%==) r=;
else r=;
}
else if(y%==) r=;
else r=;
//printf("%d %d\n",y,r);
for(m=;m<=;m++)
{
d=d+;
int res=(d+lw-)%;
if(res==) res=;
lw=res;
lw++;lw=lw%;
if(lw==) lw=;
ans[res]++;
if(m==||m==||m==||m==) d=-;
else if(m==||m==||m==||m==||m==||m==||m==) d=-;
else if(m==)
{
if(r) d=-;
else d=-;
}
}
}
printf("%d %d ",ans[],ans[]);
for(int i=;i<;i++)
printf("%d ",ans[i]);
printf("%d\n",ans[]);
return ;
}

USACO 1.2 Friday the Thirteenth的更多相关文章

  1. USACO Section1.1 Friday the Thirteenth 解题报告

    friday解题报告 —— icedream61 博客园(转载请注明出处) -------------------------------------------------------------- ...

  2. USACO . Friday the Thirteenth

    Friday the Thirteenth Is Friday the 13th really an unusual event? That is, does the 13th of the mont ...

  3. USACO Section 1.1-3 Friday the Thirteenth

    Friday the Thirteenth 黑色星期五 13号又是一个星期五.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数. 给出N年的一个 ...

  4. Friday the Thirteenth 黑色星期五 USACO 模拟 超级简单做法

    1003: 1.1.3 Friday the Thirteenth 黑色星期五 时间限制: 1 Sec  内存限制: 128 MB提交: 8  解决: 8[提交] [状态] [讨论版] [命题人:外部 ...

  5. USACO Section 1.1 Friday the Thirteenth 解题报告

    题目 题目描述 黑色星期五是否真的是一件不同寻常的事情?按理来说每个月的13号可能是星期一,或者是星期二...或者是星期天,但是黑色星期五的存在让我们不禁开始猜想,难道每个月的13号刚好是星期五的频率 ...

  6. USACO 1.1.3 Friday the Thirteenth 黑色星期五

    Description 13号又是一个星期5.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数.给出N年的一个周期,要求计算1900年1月1日至 ...

  7. JZOJ.1002【USACO题库】1.1.3 Friday the Thirteenth黑色星期五

    每日一博第一天! 保持你的决心 题目描述 13号又是星期五是一个不寻常的日子吗? 13号在星期五比在其他日少吗?为了回答这个问题,写一个程序来计算在n年里13 日落在星期一,星期二......星期日的 ...

  8. USACO Training Section 1.1黑色星期五Friday the Thirteenth

    题目描述 13号又是一个星期五.13号在星期五比在其他日子少吗?为了回答这个问题,写一个程序,要求计算每个月的十三号落在周一到周日的次数.给出N年的一个周期,要求计算1900年1月1日至1900+N- ...

  9. USACO Chapter 1 解题总结

    USACO Chapter 1 解题总结 1.1.1 Your Ride Is Here 基本字符串操作,无压力. 1.1.2 Greedy Gift Givers 基础模拟题,弄明白题意,不怕麻烦, ...

随机推荐

  1. Bootstrap-轮播图-No.5

    <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...

  2. C# ado.net 使用task和await(四)

    class Program { private static string constr = "server=.;database=northwnd;integrated security= ...

  3. CloseableHttpClient设置超时

    Java开发我们常常需要和第三方系统进行通信,通信的方式有多种,如dubbo方式,webservice,微服务和CloseableHttpClient等方式,常涉及到超时问题,这里主要说的是Close ...

  4. [jenkins] 启动错误 Failed to start LSB: Jenkins Automation Server.

    解决办法见https://blog.csdn.net/qq_34208844/article/details/87865672

  5. 【leetcode】1291. Sequential Digits

    题目如下: An integer has sequential digits if and only if each digit in the number is one more than the ...

  6. nginx之location部署yii项目(不使用nginx端口转发)

    前言: 之前部署yii项目的时候, 使用的是域名, 后来使用nginx进行端口转发(反向代理)来部署yii项目. 这一次部署尝试只使用location 进行部署(不需要使用端口). 先贴出nginx的 ...

  7. JavaScript实现 简易 堆

    有两个原始操作用于保证插入或删除节点以后堆是一个有效的最大堆或者最小堆: shiftUp(): 如果一个节点比它的父节点大(最大堆)或者小(最小堆),那么需要将它同父节点交换位置.这样是这个节点在数组 ...

  8. Java进阶知识13 Hibernate查询语言(HQL),本文以hibernate注解版为例讲解

    1.简单概述 1.1. 1) SQL:面向的是数据库 select * from tableName;2) HQL查询(Hibernate Query language): hibernate 提供的 ...

  9. 整合pjax无刷新

    一:整合pjax的准备工作: 检查你的网站是否引入1.7.0版本以上的jquery.js,如果没有请全局引入 1.新浪CDN提速:<script type="text/javascri ...

  10. Failed to execute aapt

    Failed to execute aapt 没错,看到这个表示你的资源出错了.不用想别的. 比如: Failed to execute aapt com.android.ide.common.pro ...