题目: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. (BUG已修改,最优化)安卓ListView异步加载网络图片与缓存软引用图片,线程池,只加载当前屏之说明

    原文:http://blog.csdn.net/java_jh/article/details/20068915 迟点出更新的.这个还有BUG.因为软引应不给力了.2.3之后 前几天的原文有一个线程管 ...

  2. LINUX 论文

    https://www.kernel.org/pub/linux/kernel/people/paulmck/

  3. string与StringBuilder之性能比较

    知道“StringBuilder比string性能强”好多年了,近日无聊病发作,就把这两个家伙给动了手术: using System; using System.Text; namespace Con ...

  4. the forth assignment of software testing

    软件测试用到的 pict33.msi. 加载安装即可. 顺步安装 使用背景: 假如现在有一个网站后台需要测试工程师进行测试用例设计.用常规的方法将参数列出: 帐户名: 空,不存在,超长,超短,正常 密 ...

  5. Linux grep用法整理

    grep -i 忽略大小写 grep --color grep -v 反向查找 grep -o 只显示被模式匹配到的字符串

  6. sql 随机生成中文名字

    ,) )) -- 姓氏 ,) )) -- 名字 INSERT @fName VALUES ('赵'),('钱'),('孙'),('李'),('周'),('吴'),('郑'),('王'),('冯'),( ...

  7. SQLServe错误整理

    1. sql拒绝访问?提示SQL Serve不存在或访问被拒绝 (SQL Server does not exist or access denied.) (A) 1:你如果是独立上网的请把21端口打 ...

  8. android 中 系统日期时间的获取

    import    java.text.SimpleDateFormat; SimpleDateFormat    formatter    =   new    SimpleDateFormat   ...

  9. 无法打开登录所请求的数据库 "XXX"。登录失败。 用户 'NT AUTHORITY\SYSTEM' 登录失败。

    1.打开数据库安全性-登录名 2.选择NT AUTHORITY\SYSTEM右键属性 3.选择服务器角色勾选sysadmin选项保存

  10. mongodb write 【摘自网上,只为记录,学习】

    mongodb有一个write concern的设置,作用是保障write operation的可靠性.一般是在client driver里设置的,和db.getLastError()方法关系很大 一 ...