题目: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. cocos2d-x jsb + cocosbuider 适配iphone5 尺寸

    最简单的适配iphone5的方案,应该算是直接用一块图片补上多出来的区域了: 1:Iphone5分辨率为 1136* 640 , 需要在cocosbuilder中将ccb修改为对应的尺寸: Docum ...

  2. ArrayList的深度copy和浅度拷贝

    ArrayList的浅度拷贝方式: 通过Collections.copy方法实现浅度拷贝 ArrayList<GuideGroup> questionGuideGroupList = ne ...

  3. acmer -- 最美的情书

    2014-09-29 20:51:45 POJ 2482 Fleeting time does not blur my memory of you. Can it really be 4 years ...

  4. C++ 全排列函数 nyoj 366

    C++ STL中提供了std::next_permutation与std::prev_permutation可以获取数字或者是字符的全排列,其中std::next_permutation提供升序.st ...

  5. xml_02

    1.xml 2.对于XML文档的约束   |-DTD      <!DOCTYPE 根元素 [       <!ELEMENT 元素名 (xx)>       <!ATTLIS ...

  6. MongoDB 2.6.x 的安装部署

    1. 下载mongodb 2.6.x版本的zip包,在D盘创建目录MongoDB,解压缩到D:\MongoDB目录. 创建数据库目录D:\MongoDB\data,接下来打开命令行窗口,切换到D:\M ...

  7. 使用PDO持久化连接

    无论是何种编程语言,几乎都要经常与各种数据库打交道.不过,众所周知的是,在程序与数据库之间建立连接是一件比较耗费资源的事情,因此编程技术领域的许多专家.前辈们就设想并提出了各种解决方案,以减少不必要的 ...

  8. ios Object Encoding and Decoding with NSSecureCoding Protocol

    Object Encoding and Decoding with NSSecureCoding Protocol February 27, 2014 MISC NSCoding is a fanta ...

  9. Ext.Net学习笔记06:Ext.Net DirectEvents用方补充

    在ASP.NET控件上面使用DirectEvents 我们在ASP.NET中实现无刷新的页面请求的时候,通常会用到UpdatePanel,现在Ext.Net为我们提供了另外一种渠道:通过DirectE ...

  10. NSArray 常用的一些方法

    - (NSUInteger) count; 返回数组中元素个数 - (id)objectAtIndex:(NSUInteger)index; 返回一个id类型的数组指定位置元素 - (id)lastO ...