java某年某月的天数
来源:互联网 发布:首席数据执行官 编辑:程序博客网 时间:2024/05/22 10:24
Problem Description
输入年和月,判断该月有几天?
Input
输入年和月,格式为年\月。
Output
输出该月的天数。
Example Input
2009\1
Example Output
31
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); String s=in.nextLine(); String a[]=s.split("\\\\"); int year=Integer.parseInt(a[0]); int month=Integer.parseInt(a[1]); int flag=1; if(year%4==0&&year%100!=0||year%400==0) {flag=0;} if(month==1||month==3||month==5||month==7||month==8||month==10||month==12) {System.out.println("31");} else if(month==4||month==6||month==9||month==11) {System.out.println("30");} else if(month==2) { if(flag==1) {System.out.println("28");} else {System.out.println("29");} } }}
0 0
- java某年某月的天数
- Java-判断某年某月的天数
- java循环某年某月的所有天数
- java calendar循环某年某月的所有天数
- java 获取某年某月的最大天数
- 求某年某月的天数
- 获取某年某月的天数
- 求某年某月的天数
- 某年某月的天数
- 某年某月的天数
- SQL 查找某年某月的天数
- C#获取某年某月的天数
- 1073 计算某年某月的天数
- c语言 某年某月的天数
- C++求某年某月的天数
- SDUT 1160 某年某月的天数
- 怎样得到某年某月的最大天数
- 如何获取某年某月的最大天数
- 学习和思考
- 动态参数与静态参数的判断、修改
- mac如何升级g++的版本?更改默认gcc版本
- 一些web开发的插件好看的样式集合(不定时更新)
- 最长上升子序列
- java某年某月的天数
- 插入排序、希尔排序、堆排序
- strlen 函数的编写
- android解析pdf并且使用webview展示
- sql server 2008查询CPU飙到100%
- 27-TCP 协议(快重传与快恢复)
- 上升子序列
- 编程基础小语法
- 在Python中使用__slots__方法的详细教程