当前位置: 首页 > wzjs >正文

psd 网站重庆seo整站优化报价

psd 网站,重庆seo整站优化报价,安徽省住房与城乡建设网站,什么网站做详情页好知识点 处理日期 1. 按天枚举日期:逐天遍历起始日期到结束日期范围内的每个日期。 2. 处理闰年:正确判断闰年条件。闰年定义为:年份 满足以下任意一个条件:(闰年的2月只有29天) 满足下面一个条件就是闰年 1> 是 400 的倍数…

知识点

处理日期

1. 按天枚举日期:逐天遍历起始日期到结束日期范围内的每个日期。

2. 处理闰年:正确判断闰年条件。闰年定义为:年份 满足以下任意一个条件:(闰年的2月只有29天)

满足下面一个条件就是闰年

1> 是 400 的倍数。

2> 是 4的倍数但不是 100的倍数

艺术与篮球

已知当前是星期几求出某个月的某一天是星期几

int week=x;x为第一天的日期

week = week%7+1求出每个星期的下一天

题目链接

1.艺术与篮球 - 蓝桥云课

题目解析

判断笔画数是不是超过50,超过50就去练习书法

算法原理

使用哈希表,把笔画和对应的数字联系在一起

使用日期函数来标记时间的开始和结尾,然后遍历每一天去计算笔画数

代码编写

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;public class Main {public static void main(String[] args) {Map<Character, Integer> map = new HashMap<Character, Integer>() {{put('0', 13);  // 零put('1', 1);   // 一put('2', 2);   // 二put('3', 3);   // 三put('4', 5);   // 四put('5', 4);   // 五put('6', 4);   // 六put('7', 2);   // 七put('8', 2);   // 八put('9', 2);   // 九}};LocalDate startDate = LocalDate.of(2000, 1, 1);LocalDate endDate = LocalDate.of(2024, 4, 14);int days = 0;while (startDate.isBefore(endDate)) {String s = startDate.toString().replace("-", "");int total = 0;// 通过map查询笔画数for (char c : s.toCharArray()) {total += map.get(c);}if (total > 50) {days++;}startDate = startDate.plusDays(1);}System.out.println(days);}
}

从哪开始从哪结束

LocalDate startDate = LocalDate.of(2000, 1, 1);

LocalDate endDate = LocalDate.of(2024, 4, 14);

while 循环会一直执行,直到 startDate 等于或超过 endDate。循环会逐日增加 startDate,并计算当天日期的数字笔画数。

startDate.isBefore(endDate)

转为Srting类型,并且去除-

 startDate.toString().replace("-", "");

自增天数

  startDate = startDate.plusDays(1);

补充: 获得xxx年xxx月xx日是星期几

可以使用

LocalDate date = LocalDate.of(2026, 4, 1); // 获取星期几(英文)

String weekday = date.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.ENGLISH);

另一种写法

 //造一个hash表,里面对应笔画数int[] hash = {13, 1, 2, 3, 5, 4, 4, 2, 2, 2};//month里面放每月的个数int[] months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};//计算打篮球的天数int count = 0;boolean feb = true;for (int year = 2000; year <= 2024; year++) {//笔画数int num = 0;//判断是平年还是润年//计算2月的值months[2] = isLeapYear(year) ? 29 : 28;//计算每一月,每一天for (int month = 1; month <= 12; month++) {for (int day = 1; day < months[month]; day++) {//计算年的每一位int ypos1 = year / 1000;year = year % 1000;int ypos2 = year / 100;year = year % 100;int ypos3 = year / 10;year = year % 10;int ypos4 = year;//计算月的每一位int mpos1 = month / 10;month = month % 10;int mpos2 = month;//计算每一天的每一位int dpos1 = day / 10;day = day % 10;int dpos2 = day;//计算笔画数num = hash[ypos1] + hash[ypos2] + hash[ypos3] + hash[ypos4] +hash[mpos1] + hash[mpos2] + hash[dpos1] + hash[dpos2];//最后计算天数if (num > 50) {count++;}if (year == 2024 && month == 4 && day == 13) {System.out.println(count);return;}}}}}public static void main(String[] args) {cal();}

http://www.dtcms.com/wzjs/367030.html

相关文章:

  • 福建中海建设有限公司网站磁力
  • 郑州专业手机网站制作互联网营销方法有哪些
  • 网站开发思维导图代写文案的软件
  • 艺友网站建设定制型营销网站建设
  • 网站制作维护深圳网络营销推广专员
  • 怎么让网站页面自适应免费域名服务器
  • 免费下载b站视频软件网站推广怎么做有效果
  • 北京怎么做网站推广优化设计五年级下册语文答案
  • 网站建设到运营赚钱企业站seo
  • 建设网站需要电脑配置希爱力跟万艾可哪个猛
  • 网上做的好金融网站佛山seo优化外包
  • 招聘网站排行榜2021b站网页入口
  • 烟台建设网站独立站怎么搭建
  • 中国住房建设部网站首页免费网络推广渠道
  • 做的网站有广告图片湖南百度推广公司
  • 富源县建设局网站广州百度seo排名
  • 天天外链官网seo黑帽有哪些技术
  • 做网站 五个过硬 党员干部网站seo排名免费咨询
  • 老铁推荐个2021网站好吗发稿吧
  • 搭建个网站多少钱推蛙网络
  • 建网站前途网络推广和网站推广
  • 成都网站建设联系方式在线网站建设
  • wordpress 和shopify石家庄seo优化公司
  • 网站分享代码怎么加windows优化
  • 自己如何在网上做网站广州百度快速排名优化
  • 在网站上上传文件需要怎么做seo关键词优化排名推广
  • 永久免费自助建网站站长工具端口查询
  • 凡科快图怎么用seo关键词排优化软件
  • 政府网站平台建设的一些问题seo网络排名优化技巧
  • 赣州做网站j西安seo盐城