安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

用python语言循环结构程序编写这样一个程序且要求能精简就精简:闰年是能被4整除但不能被100整除或者能被400整除的年份。请判断给定年份是否闰年。输入格式首先输入一个正整数T表示测试数据的组数然后是T组测试数据。每组测试数据输入一个年份y。输出格式对于每组测试若y是闰年输出YES否则输出NO。引号不必输出。输入样例220081900输出样例YESNO

  • 日期: 2025-06-22
  • 标签: 财经

-- coding: utf-8 --

""" Created on Tue Aug 3 15:34:19 2021

@author: Administrator """

T=int(input()) for i in range(T): y=int(input()) if y%4==0 and y%100!=0 or y%400==0: print("YES") else: print("NO")

用python语言循环结构程序编写这样一个程序且要求能精简就精简:闰年是能被4整除但不能被100整除或者能被400整除的年份。请判断给定年份是否闰年。输入格式首先输入一个正整数T表示测试数据的组数然后是T组测试数据。每组测试数据输入一个年份y。输出格式对于每组测试若y是闰年输出YES否则输出NO。引号不必输出。输入样例220081900输出样例YESNO

原文地址: https://www.cveoy.top/t/topic/hm40 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: AestheticianAestheticsAstrologistAstrologyBotanistDemographerDemographyEcologistEntomologistEntomologyEthnologistEthnologyGeographergeologistGeologyLinguisticianLinguisticsMathematicianMeteorologistMe
  • 下一篇: a Si WG-multilayer BP films integrated photodetector was reported by Youngblood et al241 This device exhibited excellent photoresponsivities of 135 and 657 mA W−1 at room temperature with a wide bandw

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2