思路:

每月有多少天是固定的,放到数组中,2月单独判断一下。

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int y = sc.nextInt();
int d = sc.nextInt();
int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};
if((y%4==0 && y%100!=0) || y%400 == 0) {
days[1] = 29;
}
int m = 0;
while(d > days[m]) {
d -= days[m];
m++;
}
System.out.println(m+1);
System.out.println(d);
}
}

最新文章

  1. 基于InstallShield2013LimitedEdition的安装包制作
  2. ASP.NET 画图与图像处理-生成高质量缩略图
  3. php 以IP的形式获取访问者的地理位置
  4. 字符串混淆技术在.NET程序保护中的应用及如何解密被混淆的字符串
  5. [R]R语言里的异常处理与错误控制
  6. [转]LUA元表
  7. iOS 8 界面设计 PSD 模板(iPhone 6),免费下载
  8. 简单几何(半平面交+二分) LA 3890 Most Distant Point from the Sea
  9. jsp页面指令
  10. Only one instance of a ScriptManager can be added to the page.
  11. CSS skills: 3) show sub-navigate items when mouse hove on nav-item
  12. 【转】 LINQ To SQL 语法及实例大全
  13. Android 滑动界面实现---Scroller类别 从源代码和开发文档了解(让你的移动布局)
  14. C# Async/await 异步多线程编程
  15. flask-script组件
  16. Apache Solr vs Elasticsearch
  17. 2019.03.09 codeforces620E. New Year Tree(线段树+状态压缩)
  18. 使用SQL查看表字段和字段说明
  19. Arch Linux中禁用UTC解决双系统时间问题
  20. file相关方法

热门文章

  1. 二十九、SAP中输出漂亮的表格
  2. scala 语言特性
  3. Bulma CSS - 简介
  4. 【Android】家庭记账本手机版开发报告二
  5. 每天一点点之javascript(ES6) - Map对象
  6. 51nod 1430:奇偶游戏 博弈
  7. Egret Engine 2D - 显示对象
  8. Python操作APP -- Appium-Python-Client
  9. SQL约束攻击
  10. Windows桌面图标不见了,可能是结束了explorer.exe进程导致