没有合适的资源?快使用搜索试试~ 我知道了~
华为OD算法题整理-Java 本资源是一个Java语言实现的华为OD算法题整理,涵盖了矩阵相交面积、热点网站、最小步数和加密数字四个知识点。 矩阵相交面积 矩阵相交面积是计算机科学中的一种基本概念,用于计算两个矩阵之间的相交面积。该问题的解决思路是通过使用Scanner类读取输入的矩阵坐标,然后计算两个矩阵之间的相交面积。该算法的关键是使用Math类中的max和min函数来计算相交面积。 热点网站 热点网站是计算机科学中的一种常见问题,用于统计热点网站的访问频率。该问题的解决思路是使用TreeMap类来存储网站的访问频率,然后使用StringJoiner类来输出热点网站的名称。该算法的关键是使用TreeMap类的自然排序特性来实现网站的排序。 最小步数 最小步数是计算机科学中的一种经典问题,用于计算从一个状态到另一个状态的最小步数。该问题的解决思路是使用递推公式来计算最小步数。该算法的关键是使用递推公式来实现最小步数的计算。 加密数字 加密数字是计算机科学中的一种常见问题,用于实现数字的加密和解密。该问题的解决思路是使用加密算法来实现数字的加密和解密。该算法的关键是使用加密算法来实现数字的加密和解密。 本资源涵盖了四个知识点,分别是矩阵相交面积、热点网站、最小步数和加密数字。这些知识点都是计算机科学中非常重要的概念,掌握这些知识点可以帮助读者更好地理解计算机科学的基本概念。
资源推荐
资源详情
资源评论
![html](https://img-home.csdnimg.cn/images/20210720083451.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![text/x-c](https://img-home.csdnimg.cn/images/20210720083646.png)
![md](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/release/download_crawler_static/88470268/bg1.jpg)
考察知识点:
算法
![](https://csdnimg.cn/release/download_crawler_static/88470268/bg2.jpg)
1.矩阵相交面积
import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int ax1=in.nextInt();
int ay1=in.nextInt();
int ax2=in.nextInt();
int ay2=in.nextInt();
int bx1=in.nextInt();
int by1=in.nextInt();
int bx2=in.nextInt();
int by2=in.nextInt();
![](https://csdnimg.cn/release/download_crawler_static/88470268/bg3.jpg)
int a1=Math.max(Math.min(ax1,ax2),Math.min(bx1,bx2));
int b1=Math.max(Math.min(ay1,ay2),Math.min(by1,by2));
int a2=Math.min(Math.max(ax1,ax2),Math.max(bx1,bx2));
int b2=Math.min(Math.max(ay1,ay2),Math.max(by1,by2));
if(a1<a2&&b1<b2){
System.out.println((a2-a1)*(b2-b1));
}else{
System.out.println("0");
}
in.close();
}
}
2.热点网站
import java.util.ArrayList;
![](https://csdnimg.cn/release/download_crawler_static/88470268/bg4.jpg)
import java.util.List;
import java.util.Scanner;
import java.util.StringJoiner;
import java.util.TreeMap;
import java.util.Map;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
TreeMap<String,Integer> map=new TreeMap<>();
while(in.hasNextLine()){
String url=in.nextLine();
if(url.replaceAll("[0-9]","").length()==0){//仅数字
//TreeMap<String,String> mapTop=new TreeMap<>();
List<String[]> listTop=new ArrayList<>();
for(Map.Entry<String,Integer> tmp:map.entrySet()){
listTop.add(new String[]{tmp.getValue()+"",tmp.getKey()});
}
listTop.sort((a,b)->Integer.valueOf(a[0])!=Integer.valueOf(b[0])?
Integer.valueOf(b[0])-Integer.valueOf(a[0]):a[1].com
pareTo(b[1]));
int top=Integer.parseInt(url);
StringJoiner sj=new StringJoiner(",");
for(int i=0;i<top;i++){
sj.add(listTop.get(i)[1]);
}
System.out.println(sj.toString());
}else{
Integer count=map.get(url)==null?0:map.get(url+"");
map.put(url,++count);
}
}
}
}
![](https://csdnimg.cn/release/download_crawler_static/88470268/bg5.jpg)
3.最小步数
剩余119页未读,继续阅读
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
![avatar-vip](https://csdnimg.cn/release/downloadcmsfe/public/img/user-vip.1c89f3c5.png)
jiai032023
- 粉丝: 0
- 资源: 21
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)