摘要: public class Main { public static void main(String[] args) { for(char x='a';x<='c';x++){ for(char y='a';y<='c';y++){ for(char z='a';z<='c';z++){ if(x! 阅读全文
posted @ 2021-03-26 07:46 chenyuan# 阅读(81) 评论(0) 推荐(0)
摘要: public class Main { //大根堆算法 public static void main(String[] args) { int []array = new int[]{0,53,17,78,9,45,65,87,32};//用a[0]=0是为了使用规则:某一个节点的序号/2,是其父 阅读全文
posted @ 2021-03-25 16:38 chenyuan# 阅读(82) 评论(0) 推荐(0)
摘要: 给定一系列正整数,请按要求对数字进行分类,并输出以下 5 个数字: A​1​​ = 能被 5 整除的数字中所有偶数的和; A​2​​ = 将被 5 除后余 1 的数字按给出顺序进行交错求和,即计算 n​1​​−n​2​​+n​3​​−n​4​​⋯; A​3​​ = 被 5 除后余 2 的数字的个数; 阅读全文
posted @ 2021-03-17 16:45 chenyuan# 阅读(93) 评论(0) 推荐(0)
摘要: import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan 阅读全文
posted @ 2021-03-17 15:44 chenyuan# 阅读(43) 评论(0) 推荐(0)
摘要: 读入 n(>)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。 输入格式 第 1 行:正整数 n 第 2 行:第 1 个学生的姓名 学号 成绩 第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ... 第 n+1 行:第 n 个学生的姓名 学号 成绩 输出格式 对每 阅读全文
posted @ 2021-03-16 13:09 chenyuan# 阅读(58) 评论(0) 推荐(0)
摘要: 给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。 public static List<Integer> spiralOrder(int[][] matrix) { List<Integer> order = new ArrayList<Integer 阅读全文
posted @ 2021-03-15 21:03 chenyuan# 阅读(495) 评论(0) 推荐(0)
摘要: 罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。 字符 数值I 1V 5X 10L 50C 100D 500M 1000例如, 罗马数字 2 写做 II ,即为两个并列的 1。12 写做 XII ,即为 X + II 。 27 写做 XXVII, 即为 XX + V + II 。 阅读全文
posted @ 2021-03-12 22:29 chenyuan# 阅读(342) 评论(0) 推荐(0)
摘要: 给你一个 32 位的有符号整数 x ,返回将 x 中的数字部分反转后的结果。 如果反转后整数超过 32 位的有符号整数的范围 [−2*31, 2*31 − 1] ,就返回 0。 初始版本,最垃圾 public static int reverse(int x) { int i=0; int max 阅读全文
posted @ 2021-03-12 18:23 chenyuan# 阅读(62) 评论(0) 推荐(0)
摘要: 题目描述:给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 的那两个整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素不能使用两遍。 public int[] twoSum(int[] nums, int target) 阅读全文
posted @ 2021-03-11 17:24 chenyuan# 阅读(59) 评论(0) 推荐(0)
摘要: 项目地址:https://gitee.com/chen_yuan_fan/androidlanya.git mainActivity package android.myapplication; import android.app.Activity; import android.bluetoot 阅读全文
posted @ 2020-06-01 22:38 chenyuan# 阅读(498) 评论(0) 推荐(0)