zoukankan      html  css  js  c++  java
  • 0031-闰年判断

    题目

    闰年判断
    难度级别:A; 运行时间限制:1000ms; 运行空间限制:51200KB; 代码长度限制:2000000B
    试题描述
    给定一个正整数 n 表示年份,判断该年是否为闰年,是闰年输出 “yes”,不是闰年输出 “no”。
    输入
    一个正整数 n
    输出
    按题目要求输出
    输入示例
    2014
    输出示例
    no
    其他说明
    数据范围: n 在 int32 范围内。

    分析

      “四年一闰,百年不闰,四百年再闰。”

      考虑到类似于1900年的情况,即n%400,就行了。

    代码

    #include<bits/stdc++.h>
    using namespace std;
    int n;
    int main()
    {
    	scanf("%d",&n);
    	if((!(n%4)&&n%100)||(!(n%400))) printf("yes");
    	else printf("no");
    	return 0;
    }
    作者:18西斯光剑
    出处:https://www.cnblogs.com/DARTH-VADER-EMPIRE/
    Copyright ©2018-2020 18西斯光剑
    All Rights Reserved.
  • 相关阅读:
    soapui + groovy 接口自动化测试 第九章
    soapui + groovy 接口自动化测试 第八章
    soapui + groovy 接口自动化测试 第七章
    soapui + groovy 接口自动化测试 第六章
    soapui + groovy 接口自动化测试 第五章
    soapui + groovy 接口自动化测试 第四章
    soapui + groovy 接口自动化测试 第三章
    soapui + groovy 接口自动化测试 第二章
    Jekins
    ES6温习
  • 原文地址:https://www.cnblogs.com/DARTH-VADER-EMPIRE/p/9491879.html
Copyright © 2011-2022 走看看