题目: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. Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils

    1.错误叙述性说明 警告: Could not create JarEntryRevision for [jar:file:/D:/MyEclipse/apache-tomcat-7.0.53/web ...

  2. java13 InputStream,Reader

    流的方向: .输入流:数据源到程序(InputStream,Reader读进来). .输出流:程序到目的地(OutPutStream,Writer写出来). 处理数据单元: 字节流:按照字节读取数据( ...

  3. careercup-数学与概率

    7.3 给定直角坐标系上的两条线,确定这两条线会不会相交. 解法: 此题有很多不确定的地方:两条线的格式是什么?两条线实为同一条怎么处理?这些含糊不清的地方最好跟面试官讨论一下. 下面将做出以下假设: ...

  4. phpcms 源码分析五:文件缓存实现

    这次是逆雪寒的文件缓存实现代码分析: /* [/php] PHPCMS的文本缓存实现: [php] <?php /* 这个文件里面全是有关生成文本缓存的函数.文本缓存是个好东西.一般的项目,我们 ...

  5. How To Install Kernel 3.10 On Ubuntu, Linux Mint, Debian and Derivates

    n this article I will show you how to install Linux Kernel 3.10 on Ubuntu 13.10 Saucy Salamander, Ub ...

  6. ssh-add命令

    ssh-add命令是把专用密钥添加到ssh-agent的高速缓存中.该命令位置在/usr/bin/ssh-add ➜ ydoc git:(v2.0.0) ✗ sudo ssh-add ~/.ssh/i ...

  7. HDFS的java客户端操作代码(Windows上面打jar包,提交至linux运行)

    1.通过java.net.URL实现屏幕显示demo1文件的内容 package Hdfs; import java.io.InputStream; import java.net.URL; impo ...

  8. msql 按值排序

    ORDER BY find_in_set(status,'705,710,706,1027,707,709,708'),create_time desc

  9. (转)Asp.NetURL重写的一种方法

    说到不用设置iis,主要是为了实现在虚拟主机或是拿不到iis操作限的时候,不能添加isap又想实现类似于静态化的程序实现方式,先声明,这里最终要实现的效果是,最终可以用 12345.html 替换 s ...

  10. 20151214 jquery插件代码备份

    ;(function ($) { //局部性的 /*$.fn.extend({ 'nav' : function (color) { $(this).find('.nav').css({ 'list- ...