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的更多相关文章

  1. 第一个Leap Motion测试页面 (webgl/three/leapjs/leap)

    div#canvas-frame{ border: none; cursor: pointer; width: 100%; height: 800px; background-color: #EEEE ...

  2. HTC Vive 与Leap Motion 出现位置错误的问题

    Leap Motion已经支持VR, 但是官方没有支持HTC Vive的例子. 按照官方的文档, 其实是有问题的: https://developer.leapmotion.com/documenta ...

  3. 到底AR初创公司Magic Leap是不是骗子?我看未必

    AR技术和VR技术在今年的发展可谓是日新月异,眼看年末已至,不成想却出现了大新闻.最炙手可热的神秘AR初创公司Magic Leap被硅谷付费媒体The Information(付费读者大多为硅谷资深投 ...

  4. Leap Motion发布新平台,直击下一代移动端VR/AR手部追踪

    2013年,动作捕捉技术公司Leap Motion发布了面向PC的体感控制器,不过销量并不乐观.随着2014年虚拟现实技术的再一次兴起,它发布一款用于Oculus Rift的附加设备,从而正式登上VR ...

  5. 安装 openSUSE Leap 42.1 之后要做的 8 件事

    导读 openSUSE Leap 确实是个巨大的飞跃,它允许用户运行一个和 SUSE Linux 企业版拥有同样基因的发行版.和其它系统一样,为了实现最佳的使用效果,在使用它之前需要做些优化设置. 下 ...

  6. leap motion

    体感控制器: 识别:手,手指和工具,获取位置,手势,动作 范围:倒金字塔,塔尖在设备中心,2.5cm~0.6米 坐标系统:采用右手笛卡尔积坐标系,返回的数值:毫米 摆放:绿灯朝向自己,z轴距离屏幕越来 ...

  7. Unity3D中使用Leap Motion进行手势控制

    Leap Motion作为一款手势识别设备,相比于Kniect,长处在于准确度. 在我的毕业设计<场景漫游器>的开发中.Leap Motion的手势控制作为重要的一个环节.以此,谈谈开发中 ...

  8. Leap Motion 开发笔记

    Leap Motion 体系架构 Leap Motion支持所有主流操作系统,leap motion在Windows系统下是作为一个服务运行的,在Mac和Linux是后台守护进程.软件通过USB线连接 ...

  9. Ventuz配置Leap Motion环境

    1.下载Leap Dev Kit 前往官网www.leapmotion.com,下载相应平台的开发包,目前PC版的最新版本为2.3.1. SDK里包含了Leap Motion的安装包,上图第二个.安装 ...

随机推荐

  1. TextView实现跑马灯效果

    网上有很多跑马灯的介绍,有很多跑马灯的代码.或许我的不是最好的,但是应该很容易明白的. 我们先来介绍一个跑马灯的代码 <LinearLayout xmlns:android="http ...

  2. springmvc学习(四)

    1.使用 @CookieValue 绑定请求中的 Cookie 值 例子: java @RequestMapping(value="/testCookieValue") publi ...

  3. hdu 1715 大菲波数(高精度数)

    Problem Description Fibonacci数列,定义如下: f(1)=f(2)=1 f(n)=f(n-1)+f(n-2) n>=3. 计算第n项Fibonacci数值. Inpu ...

  4. C++ GUI Programming with Qt4 笔记 -- chap2 QDialog

    以 finddialog 为例,介绍 QDialog.并对 Qt 的基本概念和技巧做了更进一步(chap1)的介绍. 1.MOC 扩展与signals–slots 机制 严格来说,Qt 开发,写的并不 ...

  5. 安装FreeMind

    Freemind 1.0.0 官方正式版下载地址:http://dl.pconline.com.cn/html_2/1/131/id=46751&pn=0.html 软件介绍: Freemin ...

  6. 转:基于IOS上MDM技术相关资料整理及汇总

    一.MDM相关知识: MDM (Mobile Device Management ),即移动设备管理.在21世纪的今天,数据是企业宝贵的资产,安全问题更是重中之重,在移动互联网时代,员工个人的设备接入 ...

  7. bat文件的妙用1-一键开启所有开发软件

    每天早上来的第一件事情,就是打开电脑,然后开一堆的软件 1.wamp 开发环境 2.钉钉   通讯工具 3.PHPstrom 开发工具 4.nodejs.bat Nodejs的扩展(node D:/w ...

  8. DataGridView添加另外一个控件。

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; u ...

  9. 重学C语言 -- printf,scanf

     printf();    用来显示格式串的内容          注意: 参数不可以换行,否则会出一个警告.       格式串中占位符比表达式数量多     会显示一个无意义值 格式串中占位符比表 ...

  10. MVC5之路由机制

    ---恢复内容开始--- MVC是一种模式,是基于asp.net上的一种设计.路由机制不属于MVC,路由机制属于asp.net.因此,mvc的路由机制就是基于asp.net路由机制上的一种“自定制”. ...