当前位置:网站首页>*6-2 CCF 2015-03-3 Festival
*6-2 CCF 2015-03-3 Festival
2022-07-25 09:39:00 【Ye Xiaobai】
festival
Title Description

Source code
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 1000;
int monthdays[2][13] = {
{
0,31,28,31,30,31,30,31,31,30,31,30,31},
{
0,31,29,31,30,31,30,31,31,30,31,30,31} };
int isleapyear(int year)
{
return ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) ? 1 : 0;
}
int main()
{
int a, b, c, y1, y2;
int weekd, d, leap;
cin >> a >> b >> c >> y1 >> y2;
int basedays = 0;
// Calculate from 1850 Year to y1 The days of the year
//for(int i=1850;i<y1;i++)
//basedays+=365+isleapyear(i);
basedays = (y1 - 1850) * 365 + (y1 - 1850) / 4 - (y1 - 1850) / 100 + (y1 - 1850) / 400;
// Calculate the month, year and date and output
for (int i = y1; i <= y2; i++)
{
int base_weekday = 2;// Every time a new year is calculated It's all about 1850 year 1 month 1 Day as base : Tuesday
leap = isleapyear(i);
// Calculation i year a month 1 Day is the day of the year
int days = 0;
for (int j = 1; j < a; j++)
days += monthdays[leap][j];
// hold 1850 year 1 month 1 Japan To i year a month 1 The total number of days per day is the same as 7 Seeking remainder
base_weekday += (basedays + days) % 7;
if (base_weekday > 7)
base_weekday %= 7;//i year a month 1 What day is the day of the week
int d = 1, num = 0;//d Record the number of days in the month num Record the week of the month c
while (1)
{
if (base_weekday == c)
{
num++;
}
if (num == b) break;
base_weekday++;
if (base_weekday > 7) base_weekday = 1;
d++;
}
if (d > monthdays[leap][a])
cout << "none" << endl;
else
{
cout << i << "/";
if (a < 10) cout << "0";
cout << a << "/";
if (d < 10) cout << "0";
cout << d << endl;
}
basedays += 365 + leap;
}
return 0;
}
边栏推荐
- Redis installation (Ubuntu)
- Flutter Rive 多状态例子
- Swagger2 shows that there is a problem with the get interface, which can be solved with annotations
- Jar包在阿里云服务器起起来了,安全组也开通了,但postman仍跑不通怎么办
- 换电脑后如何配置SSH
- ~2 ccf 2022-03-1 未初始化警告
- OC -- Foundation -- Collection
- 微信小程序实现轮播图(自动切换&手动切换)
- 【代码源】每日一题 分数拆分
- Database operation language (DML)
猜你喜欢

变量名可以用中文?直接把人干蒙了

A brief introduction to the interest of convolutional neural networks
![[code source] National Railway](/img/33/ea786a10417487a2426be3a28d28aa.jpg)
[code source] National Railway

*6-3 节约小能手

Install MySQL in Ubuntu and create new users

cf #785(div2) C. Palindrome Basis

Data control language (DCL)

*6-1 CCF 2015-03-2 数字排序

Voice chat app source code - produced by NASS network source code

~4.2 ccf 2021-12-1 序列查询
随机推荐
OC--Foundation--集合
*6-1 CCF 2015-03-2 数字排序
Definition of cell
@3-2 CCF 2020-12-2 期末预测之最佳阈值
js中map()函数的使用
Swift简单实现待办事项
学习 Redis linux 安装Redis
What is cerebral fissure?
Redis database foundation
语音聊天app源码-钠斯网络源码出品
SurfaceView 闪屏(黑一下问题)
cf #785(div2) C. Palindrome Basis
[code source] National Railway
*7-1 CCF 2015-09-1 数列分段
Database operation language (DML)
[GYCTF2020]Ez_ Express
那天帮妹纸装了个数据库。。。就又帮她整理了篇快捷键
App的生命周期和AppleDelegate,SceneDelegate
链表--基本操作
Stm32+hc05 serial port Bluetooth design simple Bluetooth speaker