题目:http://poj.org/problem?id=3393

不多说了,简单模拟题,因为粗心写错了两个字母,导致错了N遍,模拟还是一贯的恶心,代码实在不想优化了,写的难看了点。。

 #include <stdio.h>
#include <string.h> const int First = ;
const int Last = ; int month[] = {, , , , , , , , , , , , };
int days[][];
int weekday[][][]; int main()
{
for(int i = ; i <= ; i++)
{
memcpy(days[i], month, sizeof(month));
if( (i < && i % == ) ||
(i > && (i % == && i % != || i % == )))
{
days[i][] = ;
}
}
days[][] = ;
days[][] -= ;
weekday[][][First] = ;
for(int i = ; i <= ; i++)
{
for(int j = ; j <= ; j++)
{
weekday[i][j][Last] = (weekday[i][j][First] + days[i][j] - ) % ;
if(j != )weekday[i][j+][First] = (weekday[i][j][Last] + ) % ;
else weekday[i+][][First] = (weekday[i][j][Last] + ) % ;
}
} int t, ys, ms, ye, me;
scanf("%d", &t);
while(t--)
{
scanf("%d %d %d %d", &ys, &ms, &ye, &me);
int good = , lucky = ;
while(!(ys >= ye && ms >= me))
{
if(weekday[ys][ms][First] == || weekday[ys][ms][First] <= )
good++;
if(weekday[ys][ms][Last] == || weekday[ys][ms][Last] >= )
lucky++;
if(ms++ == )
{
ys++;
ms = ;
}
}
if(weekday[ye][me][First] == || weekday[ye][me][First] <= )
good++;
if(weekday[ye][me][Last] == || weekday[ye][me][Last] >= )
lucky++;
printf("%d %d\n", lucky, good);
}
return ;
}

POJ 3393 Lucky and Good Months by Gregorian Calendar 模拟题的更多相关文章

  1. poj 3393 Lucky and Good Months by Gregorian Calendar(模拟)

    题目:http://poj.org/problem?id=3393一道题目挺长的模拟题,参考了网上大神的题解. #include <iostream> #include <cstdi ...

  2. POJ 3393 Lucky and Good Months by Gregorian Calendar

    http://poj.org/problem?id=3393 题意 : 对于这篇长长的英语阅读,表示无语无语再无语,花了好长时间,终于读完了.题目中规定每周的周六日为假日,其他为工作日,若是一个月的第 ...

  3. POJ 3393:Lucky and Good Months by Gregorian Calendar 年+星期 模拟

    Lucky and Good Months by Gregorian Calendar Time Limit: 1000MS   Memory Limit: 65536K Total Submissi ...

  4. Lucky and Good Months by Gregorian Calendar - POJ3393模拟

    Lucky and Good Months by Gregorian Calendar Time Limit: 1000MS Memory Limit: 65536K Description Have ...

  5. Lucky and Good Months by Gregorian Calendar(poj 3393)

    大致题意: 科普文一篇,文章80%都是无用信息,因为都是常识,但是又不得不看,因为有20%是常人不知道的历史常识. 定义: Goog month : 该月第一个工作日为星期一的月份 Luckly mo ...

  6. Lucky and Good Months by Gregorian Calendar(模拟)

    http://poj.org/problem?id=3393 好大的一道模拟题,直接当阅读理解看了.下面是大神写的题意,解释的好详细. 定义: Goog month : 该月第一个工作日为星期一的月份 ...

  7. 三部曲二(基本算法、动态规划、搜索)-1003-Lucky and Good Months by Gregorian Calendar

    模拟加阅读题......虽然很多事常识性的知识,但也有许多不知道的知识,关键是不读不知道那些是已经知道的那些不是,许多重要的信息零散的分布在一大坨英文里,读起来很痛苦......自己读了一遍,读的晕晕 ...

  8. poj 1008:Maya Calendar(模拟题,玛雅日历转换)

    Maya Calendar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 64795   Accepted: 19978 D ...

  9. poj 2236:Wireless Network(并查集,提高题)

    Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 16065   Accepted: 677 ...

随机推荐

  1. DELPHI TDownLoadURL下载网络文件

      DELPHI XE6 FMX 附件:http://files.cnblogs.com/xe2011/IDHttp_fmx.7z unit Unit1; interface uses //引用 Vc ...

  2. JS数组定义

     JS数组定义收藏 function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.create ...

  3. Tsar 服务器系统和应用信息的采集报告工具

    Tsar介绍 Tsar是淘宝的一个用来收集服务器系统和应用信息的采集报告工具,如收集服务器的系统信息(cpu,mem等),以及应用数据(nginx.swift等),收集到的数据存储在服务器磁盘上,可以 ...

  4. Top 10 Questions about Java Exceptions--reference

    reference from:http://www.programcreek.com/2013/10/top-10-questions-about-java-exceptions/ This arti ...

  5. iOS开发篇-申请开发者账号流程

    1.注册一个苹果的apple id申请apple id的地址: https://appleid.apple.com/account 2.如申请公司账号,请使用以下链接免费获取邓白氏号码,以下的申请表格 ...

  6. the second assignment of software testing

    作业2期心得体会.第一期仍有未完成的项目,比如应该指定所读课题的范围,是关于哪个方面的. 作业项目一: 安装并使用CheckStyle/PMD与FindBug 现在网络上查找了一番发现checkSty ...

  7. Redis与Memcached对比

    Redis是一种高级key-value数据库.它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富,有字符串.链表.集合和有序集合.支持在服务器端计算集合的并,交和补集等.还支持多 ...

  8. js_DOM_04

    1.DOM   |-Document:文档对象 2.节点的导航 3.DHTML模型的对象   |-**document.all;获得页面中所有的元素对象       |-document.getEle ...

  9. python中关于正则表达式一

    ab+,描述一个'a'和任意个'b',那么'ab','abb','abbbbb' 正则表达式可以:1.验证字符串是否符合指定特征,比如验证是否是合法的邮件地址 2.用来查找字符串,从一个长的文本中查找 ...

  10. php模板引擎

    http://baike.baidu.com/link?url=HmXfdJBv3zpCdnZPeaSmZmqDBHlyTBnz9Rmb5it-jf1_NLHfaku6_i8ssUYbnaTQEBD4 ...