第13届浙江省赛D题POJ3939

USB3.0一致性测试方案 为各测试项目具体测试结果包括脉冲串突发时间、脉冲串重复时间、时钟周期以及眼图等完整USB3.0测试项目,工程师可以看到各项测试的具体结果方便观察。RIGOL 提供了一套完善的工具,包括数字示波器、专业的测试夹具以及全自动一致性测试软件,使得USB 3.0设备设计人员能够高效精确地进行信号捕捉、测试与分析。报告第二部分测试摘要,在此可以看到USB3.0测试所有测试项目,并且可以观看到测试是否正常,可以帮助工程师更好的判断测试结果。,以简化下载、存储以及对于多媒体的大量内容的共享。 阅读详情
/*
题目来源:13届浙江省大学生程序设计竞赛D题( POJ3939http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3939)
作者:1412190214李建青
类型:模拟
题目描述:
Description
Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date.


There was one day Edward suddenly found that if Monday was the 1st, 11th or 21st day of that month, he could remember the date clearly in that week. Therefore, he called such week "The Lucky Week".


But now Edward only remembers the date of his first Lucky Week because of the age-related memory loss, and he wants to know the date of the N-th Lucky Week. Can you help him?


Input
There are multiple test cases. The first line of input is an integer T indicating the number of test cases. For each test case:


The only line contains four integers Y, M, D and N (1 ≤ N ≤ 109) indicating the date (Y: year, M: month, D: day) of the Monday of the first Lucky Week and the Edward's query N.


The Monday of the first Lucky Week is between 1st Jan, 1753 and 31st Dec, 9999 (inclusive).


Output
For each case, print the date of the Monday of the N-th Lucky Week.


Sample Input
2
2016 4 11 2
2016 1 11 10
Sample Output
2016 7 11
2017 9 11


题目大意:定义一个Lucky Week为1号或者11号或者21号为周一的那周,求给定的Lucky Week后面(包含这周)第N个Lucky Week的日期
注意:这里每400年一次循环,一个循环有2058个Lucky Week

*/

#include<iostream>
#include<string>
#include<stdio.h>
using namespace std;
int weekday(int y,int m,int d)
{


       int tm=m>=3?(m-2):(m+10);


       int ty=m>=3?y:(y-1);


       return (ty+ty/4-ty/100+ty/400+(int)(2.6*tm-0.2)+d)%7;
}
int preoperate()
{
int year,mon,da,cont=0;
for(year=1753;year<=1753+400;year++)
{
for(mon=1;mon<=12;mon++)
{
for(da=1;da<=21;da=da+10)
{
if(weekday(year,mon,da)==1)
cont++;
}
}
}
return cont;
}
void gotowhat(int y,int m,int d,int howmany)
{
int cont=howmany;
int year,mon,da;
year=y;
for(mon=m;mon<=12;mon++)
{
for(da=(mon==m?d:1);da<=21;da=da+10)
{
         int tag=weekday(year,mon,da);
if(tag==1)
cont--;
if(cont==0)
{
cout<<year<<" "<<mon<<" "<<da<<endl;
return ;
}
}
}
for(year=y+1;year<=y+500;year++)
{
for(mon=1;mon<=12;mon++)
{
for(da=1;da<=21;da=da+10)
{
       int tag=weekday(year,mon,da);
if(tag==1)
cont--;
if(cont==0)
{
cout<<year<<" "<<mon<<" "<<da<<endl;
return ;
}
}
}
}
}
int main()
{
int t,y,m,d,number,st,ts;
int oneturn=preoperate();
cin>>t;
while(t--)
{
cin>>y>>m>>d>>number;
st=number%2058;
ts=number/2058;
y+=400*ts;
                number=number-2058*ts;
gotowhat(y,m,d,number);
}
return 0;
}



SAP FICO实操:如何修改已发生业务数据的成本中心公司代码(附RKACOR06程序运行指南) 本文详细解析了SAP FICO系统中使用RKACOR06程序修改已发生业务数据的成本中心和公司代码的实操方法。通过实战案例分享,提供从前期准备到后期验证的全流程指南,帮助企业应对组织架构重组或财务核算体系调整时的数据迁移挑战,特别适用于跨公司代码的成本中心划转场景。 阅读详情

相关推荐

SPARTAN6 + Verilog - FPGA step by step 从0开始学习(1)

SPARTAN6 + Verilog - FPGA step by step 从0开始学习(1)Step 1 软件安装Step 2 硬件获取Step 3 开始从头到脚建一个工程Step 3.1 新建一个工程 从0开始学习FPGA,最好的办法就是先建一个最简单的模块,并且跑起来,然后再慢慢展开。下面这个例子是要按照一定的周期点亮核心板上的一个led。 Step 1 软件安装 这个从0开始学习是用的xilinx的SPARTAN6。SPARTAN6集成开发环境用ISE,不能用Vivado,各自对应的版本不同。安装

xfacexx点点记录 5508

ZOJ 3939。规律题

规律题。400年一个大闰年一循环。次数2058一循环。打表得出规律。直接模拟求出即可 #include &lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; #define inf 0x3f3f3f3f3f3f3f3f const int maxn=1e5+9; #define mem(aa,bb) memset(aa,...

zxy160的博客 254

解决eNSP安装WinPcap版本冲突的完整指南

网络数据包捕获工具WinPcap是网络仿真环境的基础组件,其版本兼容性直接影响eNSP等网络模拟器的正常运行。当系统已安装新版WinPcap时,eNSP内置的旧版安装程序会因版本校验机制触发报错。通过彻底卸载现有驱动、安装特定版本WinPcap 4.1.2,并验证注册表和服务状态,可解决版本冲突问题。对于需要同时使用新版驱动的场景,可采用虚拟机隔离或Npcap兼容模式。该方案适用于Windows 10/11系统环境,涉及驱动签名、虚拟网卡等典型网络工程问题。

weixin_32612263的博客 336

2016第十三届浙江省赛 D - The Lucky Week

 &#13; D - The Lucky Week&#13;  &#13;  &#13; Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date.&#13; There was one day Edward suddenly found t...

蔡军帅 367

蓝牙HCI Dongle实战:从芯片选型到协议栈集成的完整指南

本文详细介绍了蓝牙HCI Dongle的实战应用,从芯片选型到协议栈集成的完整指南。通过对比CSR8510、nRF52840等主流芯片的性能和价格,提供选型建议和避坑技巧。同时,深入解析Zephyr协议栈移植和常见问题排查,帮助开发者高效完成蓝牙项目开发。

weixin_30786657的博客 321

保姆级教程:在PyCharm里用Continue插件一键接入DeepSeek API(含乱码修复)

本文详细介绍了如何在PyCharm中通过Continue插件无缝集成DeepSeek API,提供从环境准备到高级配置的全流程指南,包括解决常见的乱码问题。通过本教程,开发者可以轻松实现AI编程助手的高效调用,提升代码编写和调试效率。

weixin_30275415的博客 850

2016第七届ACM山东省赛

“题目说的是输出编号。输出编号!!” “好,改好了。” “交。” 最后两分钟再一次提交了代码。 no  -  wrong。 奋战到最后一秒,这次三个人都没有放弃,最后二开,虽然两道题都没出来,但是坚持到最后一秒,精神可嘉。 省赛的结果是五道题,铜牌。作为一只大一代表队,心里感觉还是挺不错的,算是正常发挥吧。不过因为最后两个多小时搞了图论的  C  题,没能有时间看博弈,挺遗憾的。 比

窦小雨的小点子 3万+

SAP FICO 银企直连

银企直联或者自动付款的目的是和银行做一个接口,把SAP中的到期应付款(也包括预付款)按照一定格式(银行要求的)在审批后发送给银行,请银行按照这个付款指定进行付款,并跟踪付款状态的过程,这个过程在SAP中如何实现呢?根据个人项目经验,客户需求可分为如下三种: 1. 第一种是完全不自动方式,仅批量生成付款凭证,实际的付款还是通过原来的流程执行,和银行没有任何接口; 2. 第二种是半自动方式,这种方式下需要按照银行的要求的格式生成付款条件,然后把付款文件下载下来,通过企业版的网银接口把付款文件进行上载,提交后

IamRunjiang的博客 9288

2016ACM省赛总结

总结本该立马写的,然而题目刚要过来,再补充一下细节吧。    说下进度,第一个题目,A题,一道水题,我们登陆进去PC2后,就发现山理已经开了一血了,然后我们就是读题,这个进度不是很快,英语压制,向上取整,大约在二十分之内a掉,然后我一读k题,果断水题,单词倒置,龙哥直接开写,其实这些水题交给我也能1Y,可能是我长期处于出思路读题位置,对写题方面的自信有所下降,龙哥开写,遇到bug,打印,给任,然

huatian5的博客 3067

BIDS数据存储格式介绍与dcm2bids安装与使用

BIDS格式&dcm2bids安装与使用

machinelearning_er的博客 7309

手把手教你学基带SOC芯片(4.4.9)--基带芯片的电源管理实例:高通 Snapdragon 系列实例(十)

Snapdragon 888 通过支持多种深度睡眠模式,如 AOAC 模式、低功耗模式和深度睡眠模式,以及智能电源管理技术,实现了对功耗的精细管理。这些模式不仅延长了设备的电池寿命,还确保了用户在各种使用场景下的良好体验。无论是保持网络连接、限制后台活动,还是完全关闭不必要的功能,Snapdragon 888 都能够灵活应对,提供高效的功耗管理方案。

MHD0815的博客 740

浙江大学第13届程序设计竞赛总结

一大早被赛会给坑了,说是一个人不能领三人的证,于是不到八点就爬起来,屁颠屁颠地赶过去了。事实上由于人太多了,依然是一人领了三人的证。下午四个小时的比赛一晃而过,最终3 AC 1 TLE 1 Debugging 15 Rank,相对来说是个可以接受但略带遗憾的成绩。 三月初刚开学的时候觉得很无聊,于是想做做ACM刺激一下,开始看了一些竞赛的基础知识。只不过依然很烦看书,后面还是直接转向刷题,首先是

LibZuXu 1257

IgH EtherCAT 从入门到精通:第 29 章 实战:EoE 远程维护通道搭建

摘要:本章详细介绍了基于EoE(Ethernet over EtherCAT)协议的远程维护通道搭建方案。主要内容包括:1)网络架构设计,采用管理网络与EoE子网隔离的方案;2)从站EoE支持确认与IP地址配置,提供API和命令行两种方式;3)路由/交换两种部署模式,重点推荐路由模式并给出自动化配置脚本;4)SSH远程访问配置,包括直接连接和跳板访问两种方式;5)安全加固措施,如防火墙规则、SSH密钥认证等;6)故障恢复机制与性能注意事项。该方案实现了通过EtherCAT网络对从站设备的远程SSH访问、文件

从事嵌入式linux android驱动开发,拥有全栈能力 360

2016 浙江省赛 The 13th Zhejiang Provincial Collegiate Programming Contest D题 循环节

链接:戳这里 The Lucky Week Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one

Cross 719

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

D The Lucky Week

一开始是这么想的,七天七天加,保证每次都是星期一,每次遇到1,11,21就找到了 但N有10^9,肯定会超时。那么马上打表找规律,可就是找不出规律。 看了大神的,400年是一个周期,有2058个Lucky Week。找到规律后马上就AC了 #include #include #include using namespace std; int month[]={0,31,28,31,30,31

BRCOCOLI的博客 478

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

ZOJ 146 - The 13th Zhejiang Provincial Collegiate Programming Contest - C Defuse the Bomb

Defuse the Bomb Time Limit: 2 Seconds      Memory Limit: 65536 KB The bomb is about to explode! Please defuse it as soon as possible! There is a display showing a number from 1 to 4 on the bomb

不想宅的冷同学 1047

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

zoj 3822 Domination 【概率DP 求期望】

Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with his

世界很大 1053

ZOJ-3939-The Lucky Week(日期循环节)

The Lucky Week Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Ed

不会吃鱼的喵 703

The Lucky Week

Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Edward suddenly found that if Monday was the 1st, 11th or 21st day of that month,...

yangzijiangac的博客 270

2016.4.23 浙江省赛题解

Apples and Ideas Time Limit: 2 Seconds      Memory Limit: 65536 KB "If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if

Eminem1147的博客 1万+

资格赛d题

#include #include int main() {     int T;     scanf("%d",&T);     while(T--!=0)     {           int H,M;                  scanf("%d:%d",&H,&M);           if(M!=0)               printf("0\n"

ZZU_DF的专栏 828

zoj3939 The Lucky Week 模拟

题目: The Lucky Week Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %lld & %llu Submit Status Description Edward, the headmaster of the Marjar Uni

894383755的博客 824

ZOJ 3939 The Lucky Week 2016省赛

The Lucky Week Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Edward

黑猫5027的博客 1481

Highway Project 浙江省第十三届省赛K题 ZOJ 3946(dijkstra+邻接表+优先队列)

Highway Project Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the

LiQiyao的博客 907

ZOJ3939-The Lucky Week

The Lucky Week Time Limit: 2 Seconds      Memory Limit: 65536 KB Edward, the headmaster of the Marjar University, is very busy every day and always forgets the date. There was one day Edward

wang_128的博客 544

The Lucky Week(打表找规律)

The Lucky WeekTime Limit: 2 Seconds      Memory Limit: 65536 KBEdward, the headmaster of the Marjar University, is very busy every day and always forgets the date.There was one day Edward suddenly fou...

howell 449
上一篇: HDU2446
下一篇: 标准字符串std::string和System::String, CString之间的转换
seekforcode
博客等级 码龄12年 9粉丝 41原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值