Leap Years
Description:
In this kata you should simply determine, whether a given year is a leap year or not. In case you don't know the rules, here they are:
- years divisible by 4 are leap years
- but years divisible by 100 are no leap years
- but years divisible by 400 are leap years
Additional Notes:
- Only valid years (positive integers) will be tested, so you don't have to validate them
Examples can be found in the test fixture.
using System; public static class Kata
{
public static bool IsLeapYear(int year)
{
// TODO
bool flag = false;
if (year % == )
{
if (year % == )
{
if (year % == )
{
flag = true;
}
}
else
{
flag = true;
}
}
return flag;
}
}
其他人的解法:物体吐槽了,.net自带了相关的函数
using System; public static class Kata
{
public static bool IsLeapYear(int year)
{ return DateTime.IsLeapYear(year);
}
}
Leap Years的更多相关文章
- 第一个Leap Motion测试页面 (webgl/three/leapjs/leap)
div#canvas-frame{ border: none; cursor: pointer; width: 100%; height: 800px; background-color: #EEEE ...
- HTC Vive 与Leap Motion 出现位置错误的问题
Leap Motion已经支持VR, 但是官方没有支持HTC Vive的例子. 按照官方的文档, 其实是有问题的: https://developer.leapmotion.com/documenta ...
- 到底AR初创公司Magic Leap是不是骗子?我看未必
AR技术和VR技术在今年的发展可谓是日新月异,眼看年末已至,不成想却出现了大新闻.最炙手可热的神秘AR初创公司Magic Leap被硅谷付费媒体The Information(付费读者大多为硅谷资深投 ...
- Leap Motion发布新平台,直击下一代移动端VR/AR手部追踪
2013年,动作捕捉技术公司Leap Motion发布了面向PC的体感控制器,不过销量并不乐观.随着2014年虚拟现实技术的再一次兴起,它发布一款用于Oculus Rift的附加设备,从而正式登上VR ...
- 安装 openSUSE Leap 42.1 之后要做的 8 件事
导读 openSUSE Leap 确实是个巨大的飞跃,它允许用户运行一个和 SUSE Linux 企业版拥有同样基因的发行版.和其它系统一样,为了实现最佳的使用效果,在使用它之前需要做些优化设置. 下 ...
- leap motion
体感控制器: 识别:手,手指和工具,获取位置,手势,动作 范围:倒金字塔,塔尖在设备中心,2.5cm~0.6米 坐标系统:采用右手笛卡尔积坐标系,返回的数值:毫米 摆放:绿灯朝向自己,z轴距离屏幕越来 ...
- Unity3D中使用Leap Motion进行手势控制
Leap Motion作为一款手势识别设备,相比于Kniect,长处在于准确度. 在我的毕业设计<场景漫游器>的开发中.Leap Motion的手势控制作为重要的一个环节.以此,谈谈开发中 ...
- Leap Motion 开发笔记
Leap Motion 体系架构 Leap Motion支持所有主流操作系统,leap motion在Windows系统下是作为一个服务运行的,在Mac和Linux是后台守护进程.软件通过USB线连接 ...
- Ventuz配置Leap Motion环境
1.下载Leap Dev Kit 前往官网www.leapmotion.com,下载相应平台的开发包,目前PC版的最新版本为2.3.1. SDK里包含了Leap Motion的安装包,上图第二个.安装 ...
随机推荐
- ###Linux基础 - 3
点击查看Evernote原文. #@author: gr #@date: 2014-10-15 #@email: forgerui@gmail.com 一.GCC编译程序 在Windows下使用Vis ...
- 第十三篇、jQuery Mobile
API-->搜索data 0.page data-transition="slide" // 页面切换效果 data-position="fixed" / ...
- iOS创建UUID
- (NSString *)getUUID { CFUUIDRef uuidObj = CFUUIDCreate(nil); //create a new UUID NSString * uuidSt ...
- iOS scrollView/tableView滚动到底部
//项目要求tableView滚动到底部就自动加载下一页,UITableView继承自UIScrollView 所以可以在//scrollViewDidEndDecelerating这个方法中进行判断 ...
- 封装DB类
封装DB类 一般一个类单独书写在一个Php文件中,为了见名知意,会对文件名有一个规范:类名.class.php 第1步: 创建DB类 第2 步: 属性设计 第3步: 初 ...
- Java中的String类
/*String类用于描述字符串事物的那么它就提供了多个方法对字符串进行操作 方法都会用,字符串这块就结束了常见的操作有哪些?“abcd”它应该具备什么功能,我们才能更好得操作它?1.获取(必须要掌握 ...
- 快速开启Windows 的各种任务及 bat(ch)脚本
MSC It is the Microsoft Management Console Snap-in Control File, like services.msc, devmgmt.msc (Dev ...
- 常用AWK命令
常用AWK命令 Awk is a programming language which allows easy manipulation of structured data and the gene ...
- Trie的C++实现及HDU1251,hdu1671
#include<iostream> #include<cstdio> #include<string> #include<cstring> #incl ...
- checked
<!doctype html><html lang="en"> <head> <meta charset="UTF-8" ...