Calendar - SGU 115(日期判断)
这年的开始的第一天是星期 1
代码如下:
========================================================================================================
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std; ///平年
int M[]={,,,,,,,,,,,,}; int Week(int date, int month)
{
int w=date; if(month> || month< || date< || date > M[month])
return -; for(int i=; i<month; i++)
w += M[i]; return (w%) ? (w%) : ;
} int main()
{
int date, month; scanf("%d%d", &date, &month); int w = Week(date, month); if(w < )
printf("Impossible\n");
else
printf("%d\n", w); return ;
}
Calendar - SGU 115(日期判断)的更多相关文章
- 分享一个根据具体的日期判断星座的PHP函数
其实原理很简单,也就是把所有的星座月份日期范围存储到一个数组中,然后根据日期判断属于哪个范围,这样就得到是哪个星座了. 下面的这个函数写的比较精炼,可以参考一下 function constellat ...
- Calendar 日期判断 等于 。小于。大于
public static void main(String[] args) throws Exception { String startTime = "2012-12-12 12:45: ...
- SGU 115.Calendar
连水3道,还能更水么... #include <stdio.h> using namespace std; ] = {, , , , , , , , , , , , }; int n, m ...
- 【Java】实现一个根据日期判断星座程序的编写
思路 直接根据月份做索引,然后根据日期边界判断是本月的星座还是上月的. 算法 private static String getAstro(int month, int day) { String[] ...
- easyui datebox 扩展清空按钮及日期判断
<input id="EndHavDate" class="easyui-datebox" data-options="prompt:'请选择结 ...
- sql中字符分割,日期判断,以及函数的应用
前两天公司有一个功能需求,客户给出几天的工作时间和休息,然后顾客的访问时间必须要在工作时间之内和休息时间之外,所以要求做一下判断.本来以为这个没什么,谁知道客户提供的工作时间段和休息时间段不定,给出的 ...
- JavaScript中,本周、上周、本月、上月日期判断
/** * 获取本周.本季度.本月.上月的开端日期.停止日期 */ var now = new Date(); //当前日期 var nowDayOfWeek = now.getDay(); //今天 ...
- mydate97时间控件最大值最小值限制及Javascript日期判断大小
<script language="javascript" type="text/javascript" src="<%=basePath ...
- Broken line - SGU 124(判断点与多边形的关系)
题目大意:RT 分析:构造一条射线,如果穿越偶数条边,那么就在多边形外面,如果穿越奇数条边,那么就在多边形里面. 代码如下: ===================================== ...
随机推荐
- 使用methodSignatureForSelector与forwardInvocation实现消息转发 (转)
转自:http://blog.sina.com.cn/s/blog_8c87ba3b0102v006.html 在给程序添加消息转发功能以前,必须覆盖两个方法,即methodSignatureForS ...
- CoreAnimation5-图层时间和缓冲
图层时间 动画的发生是需要持续一段时间的,所以计时对整个概念来说至关重要.在这一章中,我们来看看CAMediaTiming,看看Core Animation是如何跟踪时间的. CAMediaTimin ...
- 利用c语言做简单的迷宫小游戏
#include <stdio.h> #define ROW 6 #define COL 6 // 封装打印地图的函数 void printMap(c ...
- Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)解决方法
登陆mysql的时候,出现了这个问题: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' ( ...
- struts.xml文件示范
<?xml version="1.0" encoding="GBK"?> <!--下面指定Struts2配置文件的DTD信息--> &l ...
- oracle系列索引
今天终于把oracle入门的知识通篇过了一遍. 一篇文章没有写,先做个索引.把知识系统的梳理下. 数据库基本概念-oracle介绍 oracle安装,配置,启动 oracle工具 sqlplus 用户 ...
- supervisor进程管理
install : apt-get install supervisor crete a xxxx.conf file at /etc/supervisor/conf.d the cont ...
- 很少有人知道的c++中的try块函数
c++有一些在现实世界中很少看到的结构.这些结构有着自己的用法,但是要特别小心保守的予以运用.就像是网站 The Old New Thing首页标题上面的说的那样: “代码通常被读的次数原因超过了被写 ...
- 2016021902 - linux解压缩命令
转载自:http://blog.csdn.net/luo86106/article/details/6946255 .gz 解压1:gunzip FileName.gz 解压2:gzip -d Fil ...
- 关于Memcache使用的工具类
分布式缓存有它自己的好处 . 下面的 ConstValue.sessionId 是一个常量 public static readonly string sessionId = "sessi ...